Color harmony generation based on color theory principles.
All functions take an RGB tuple and return lists of RGB tuples. Operations are purely mathematical — no I/O, no state.
Supported Harmonies
- Complementary: Color opposite on the wheel (180°)
- Analogous: Adjacent colors (±30°)
- Triad: Three colors equidistant at 120°
- Square: Four colors at 90° intervals
- Monochromatic: Lightness variations of the same hue
- Split Complementary: Complement ± flanking colors
- Compound: Complement plus analogous neighbors
Type aliases defined here reference the canonical types in Pote.
Usage
iex> Pote.Harmonies.complementary({255, 87, 51})
[{51, 219, 255}]
iex> Pote.Harmonies.triad({255, 87, 51})
[{51, 255, 87}, {87, 51, 255}]
Summary
Functions
Returns analogous colors (±30° adjacent on the wheel).
Returns the analogous colors with custom angle.
Returns the complementary color (opposite on the hue wheel, +180°).
Returns compound (double complementary) harmony colors.
Darkens a color by mixing it with black.
Lightens a color by mixing it with white.
Returns monochromatic variations (same hue, different lightness).
Returns split complementary colors.
Returns square harmony colors (four colors equally spaced at 90°).
Returns the triad colors (three colors equally spaced at 120°).
Types
@type rgb() :: Pote.rgb()
Functions
Returns analogous colors (±30° adjacent on the wheel).
Returns 2 colors: one at -30° and one at +30°.
Examples
iex> analogous({255, 0, 0})
[{255, 128, 0}, {255, 0, 128}]
Returns the analogous colors with custom angle.
Parameters
rgb- RGB color tupleangle- Angle in degrees (default: 30)
Returns
- List of 2 RGB color tuples
Returns the complementary color (opposite on the hue wheel, +180°).
Examples
iex> complementary({255, 0, 0})
[{0, 255, 255}]
Returns compound (double complementary) harmony colors.
Combines complementary and analogous: produces 4 colors forming two complementary pairs offset by 30°.
Examples
iex> compound({255, 0, 0}) |> length()
4
Darkens a color by mixing it with black.
Parameters
rgb- Source coloramount- Amount to darken (0.0–1.0, default: 0.2)
Examples
iex> darker({200, 200, 200}, 0.5)
{100, 100, 100}
Lightens a color by mixing it with white.
Parameters
rgb- Source coloramount- Amount to lighten (0.0–1.0, default: 0.2)
Examples
iex> lighter({100, 100, 100}, 0.5)
{178, 178, 178}
@spec monochromatic(rgb(), pos_integer()) :: [rgb()]
Returns monochromatic variations (same hue, different lightness).
Generates steps variations evenly distributed in lightness from 20% to 80%.
Parameters
rgb- Source colorsteps- Number of variations to generate (default: 5)
Examples
iex> monochromatic({255, 0, 0}, 3) |> length()
3
Returns split complementary colors.
Takes the complement (180°) then flanks it with ±30°. Returns 2 colors: complement-30° and complement+30°.
Examples
iex> split_complementary({255, 0, 0}) |> length()
2
Returns square harmony colors (four colors equally spaced at 90°).
Returns 3 additional colors (the original is implied as the first).
Examples
iex> square({255, 0, 0}) |> length()
3
Returns the triad colors (three colors equally spaced at 120°).
Returns 2 additional colors (the original is implied as the third).
Examples
iex> triad({255, 0, 0}) |> length()
2