color_stream v0.0.2 ColorStream

Functions for generating colors in a fairly nice-looking way.

Summary

Functions

Starts an infinite stream of colors generated as 6-character hex strings

Converts an RGB color to its 6-character hex representation

Converts an RGB color to its 6-character hex representation

Functions

hex(opts \\ [])

Starts an infinite stream of colors generated as 6-character hex strings.

Options

  • :hue - initial hue (0..1]
  • :saturation - saturation (0..1)
  • :value - value (0..1)
hsv360_to_rgb(triplet)

Specs

hsv360_to_rgb({Float.t, Float.t, Float.t}) :: String.t
hsv360_to_rgb(h, s, v)
hsv_to_hex(h, s, v)
hsv_to_rgb(h, s, v)
rgb_to_hex(triplet)

Specs

rgb_to_hex({Float.t, Float.t, Float.t}) :: String.t

Converts an RGB color to its 6-character hex representation.

Examples:

iex> ColorStream.rgb_to_hex({5, 19, 0})
"051300"

iex> ColorStream.rgb_to_hex({125, 100, 190})
"7D64BE"
rgb_to_hex(r, g, b)

Specs

rgb_to_hex(Float.t, Float.t, Float.t) :: String.t

Converts an RGB color to its 6-character hex representation.

Examples:

iex> ColorStream.rgb_to_hex(0, 0, 0)
"000000"

iex> ColorStream.rgb_to_hex(25, 100, 190)
"1964BE"