Hash any Ruby object into an RGB color

If you want to label things with a color but don't actually care which cholor, you can use the attached Colorizer class.

To get a completely random color (some of which will clash with your design):

Colorizer.colorize(some_object) # => "#bb4faa"

To get similiar colors (e. g. bright, pale colors of different hues):

 # random hue, saturation of 0.5, lightness of 0.6
Colorizer.colorize_similarly(some_object, 0.5, 0.6) # => "#bbaaaa"

Also see the color gem Show archive.org snapshot .

Dominik Schöler Almost 10 years ago