View Source MotleyHue (Mötley Hüe v0.3.0)

An Elixir utility for calculating the following color combinations:

  • Complimentary - Two colors that are on opposite sides of the color wheel
  • Analagous - Three colors that are side by side on the color wheel
  • Monochromatic - A spectrum of shades, tones and tints of one base color
  • Triadic - Three colors that are evenly spaced on the color wheel
  • Tetradic - Four colors that are evenly spaced on the color wheel

Link to this section Summary

Functions

Returns the provided color and its two analagous (adjacent) colors along a given direction of the HSV color wheel. Adjacency is defined by a 30° offset in hue value and an analogous set must reside within a 90° section of the color wheel.

Returns the provided color and its compliment. Note that complimentary color can be calculated by either taking the value 180° (i.e., opposite) from the hue value on the HSV color wheel or by finding the RGB value that when combined with the provided color will yield white (i.e., rgb(255, 255, 255)). The default approach is to use the HSV hue offset, but either can be calculated by passing :hsv or :rgb as the model argument.

Returns the requested count of colors, including the provided color, distributed along the color wheel. Ideal for use as color palette where adjacent colors need to be easily differentiated with one another (e.g., categorical or other non-quantitative data).

Returns the requested count of colors, including the provided color, evenly spaced along the color wheel.

Returns the provided color and its monochromatic color spectrum towards black. The number of results is configurable with each color equally spaced from the previous value.

Returns the provided color and its three tetradic colors, which are the colors 90°, 180°, and 270° offset from the given color's hue value on the HSV color wheel.

Returns the provided color and its two triadic colors, which are the colors 120° and 240° offset from the given color's hue value on the HSV color wheel.

Link to this section Functions

Link to this function

analagous(color, direction \\ :clockwise)

View Source

Specs

analagous(binary() | map(), :clockwise | :counter_clockwise) ::
  list() | {:error, binary()}

Returns the provided color and its two analagous (adjacent) colors along a given direction of the HSV color wheel. Adjacency is defined by a 30° offset in hue value and an analogous set must reside within a 90° section of the color wheel.

Examples

iex> MotleyHue.analagous("FF0000")
["FF0000", "FF8000", "FFFF00"]

iex> MotleyHue.analagous("FF0000", :counter_clockwise)
["FF0000", "FF0080", "FF00FF"]
Link to this function

complimentary(color, model \\ :hsv)

View Source

Specs

complimentary(binary() | map(), :hsv | :rgb) :: list() | {:error, binary()}

Returns the provided color and its compliment. Note that complimentary color can be calculated by either taking the value 180° (i.e., opposite) from the hue value on the HSV color wheel or by finding the RGB value that when combined with the provided color will yield white (i.e., rgb(255, 255, 255)). The default approach is to use the HSV hue offset, but either can be calculated by passing :hsv or :rgb as the model argument.

Examples

iex> MotleyHue.complimentary("FF0000")
["FF0000", "00FFFF"]

iex> MotleyHue.complimentary("008080", :hsv)
["008080", "800000"]

iex> MotleyHue.complimentary("008080", :rgb)
["008080", "FF7F7F"]

Specs

contrast(binary() | map(), integer()) :: list() | {:error, binary()}

Returns the requested count of colors, including the provided color, distributed along the color wheel. Ideal for use as color palette where adjacent colors need to be easily differentiated with one another (e.g., categorical or other non-quantitative data).

Examples

iex> MotleyHue.contrast("FF0000", 7)
["FF0000", "FFFF00", "00FF00", "00FFFF", "0000FF", "FF00FF", "FF8000"]

iex> MotleyHue.contrast("FF0000", 13)
["FF0000", "FFFF00", "00FF00", "00FFFF", "0000FF", "FF00FF", "FF8000", "80FF00", "00FF80", "0080FF", "8000FF", "FF0080", "FF4000"]

Specs

even(binary() | map(), integer()) :: list() | {:error, binary()}

Returns the requested count of colors, including the provided color, evenly spaced along the color wheel.

Examples

iex> MotleyHue.even("FF0000", 5)
["FF0000", "CCFF00", "00FF66", "0066FF", "CC00FF"]
Link to this function

monochromatic(color, count \\ 3)

View Source

Specs

monochromatic(binary() | map(), integer()) :: list() | {:error, binary()}

Returns the provided color and its monochromatic color spectrum towards black. The number of results is configurable with each color equally spaced from the previous value.

Examples

iex> MotleyHue.monochromatic("FF0000")
["FF0000", "AB0000", "570000"]

iex> MotleyHue.monochromatic("FF0000", 5)
["FF0000", "CC0000", "990000", "660000", "330000"]

Specs

tetradic(binary() | map()) :: list() | {:error, binary()}

Returns the provided color and its three tetradic colors, which are the colors 90°, 180°, and 270° offset from the given color's hue value on the HSV color wheel.

Examples

iex> MotleyHue.tetradic("FF0000")
["FF0000", "80FF00", "00FFFF", "8000FF"]

Specs

triadic(binary() | map()) :: list() | {:error, binary()}

Returns the provided color and its two triadic colors, which are the colors 120° and 240° offset from the given color's hue value on the HSV color wheel.

Examples

iex> MotleyHue.triadic("FF0000")
["FF0000", "00FF00", "0000FF"]