Rainbow provides functions for generating constistent colors based on the input provided.
iex> Rainbow.colorize("boring grey")
"#82D458"
iex> Rainbow.colorize("no hex color", format: "rgba")
"rgba(45, 100, 139, 1.0)"
iex> Rainbow.colorize("almost invisible", format: "rgba", opacity: 0.1)
"rgba(88, 98, 191, 0.1)"
One of:
- string
- integer
- float
- atom
- binary
- format: the format of output
- "hex_color" (default)
- "rgba"
- opacity: used in case
format: "rgba"
- 0.0 - 1.0 (default)
The package can be installed by adding rainbow
to your list of dependencies in mix.exs
:
def deps do
[
{:rainbow, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/rainbow.