I ported a js lib colour_hash to get an assigned color of a string.

ColourHash

The idea is to be able to assign a colour to a user or concept that is inline with your current key colours

A port of https://github.com/zenozeng/color-hash

Examples

iex> ColourHash.hex("test") "186CE0" iex> ColourHash.rgb("test") {24, 108, 224} iex> ColourHash.hsl("test") {274, 0.65, 0.65} iex> ColourHash.hex("test", %{lightness: [0.1], saturation: [0.1, 0.9], hue_range: %{min: 30, max: 30} } ) "18171C" 

Github: https://github.com/zesarone/colour_hash
Hex.pm: https://hexdocs.pm/colour_hash.

Hope you guys like it and find it useful! :slight_smile:

12 Likes

I already have a place where this could be useful! ^.^

2 Likes

thank you, I always use this function in every language :slight_smile: glad you have done it for elixir!

2 Likes