Rainbow v0.1.0 Rainbow View Source

Rainbow provides functions for generating constistent colors based on the input provided.

Link to this section Summary

Functions

Returns an input-consistent random color in the format of choice. Inputs supported

Link to this section Functions

Link to this function

colorize(input, options \\ [])

View Source

Returns an input-consistent random color in the format of choice. Inputs supported:

  • string
  • integer
  • float
  • atom
  • binary

Options:

  • format: "hexcolor" (default), "rgba"
  • opacity: float between 0.0 and 1.0 (defaults to 1.0, only used in case format: "rgba")

Examples

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)"