Color Scheme Methods
Generate complementary, analogous, triadic, tetradic color schemes, and custom-sized palettes with the Color class.
Color Scheme Methods
getComplementaryColor()
Generates the complementary color (180° rotation in HSL space).
Signature
getComplementaryColor(): ColorReturns
Color: The complementaryColorinstance.
Example
playground.ts
getAnalogousColors()
Generates a three-color analogous palette consisting of the base color and two colors ±30° apart in HSL space.
Signature
getAnalogousColors(): [Color, Color, Color]Returns
[Color, Color, Color]: The base color and two analogous colors.
Example
playground.ts
getTriadColors()
Generates a three-color triadic palette consisting of the base color and two colors 120° apart in HSL space.
Signature
getTriadColors(): [Color, Color, Color]Returns
[Color, Color, Color]: The base color and two triadic colors.
Example
playground.ts
getTetradColors()
Generates a four-color tetradic palette consisting of the base color and three colors 90° apart in HSL space.
Signature
getTetradColors(): [Color, Color, Color, Color]Returns
[Color, Color, Color, Color]: The base color and three tetradic colors.
Example
playground.ts
generatePalette()
Generates a color palette of evenly distributed hues, preserving the current color's saturation, lightness, and alpha.
Signature
generatePalette(count?: NumberRange<1, 360>, step?: NumberRange<1, 360>): Array<Color>Parameters
| Parameter | Type | Description |
|---|---|---|
count | NumberRange<1, 360> | The number of colors to generate (clamped to 1–360). Default: 7. |
step | NumberRange<1, 360> | The hue step in degrees between consecutive colors (clamped to 1–360). Default: 360 / count. |
Returns
Array<Color>: An array ofColorinstances with the specified count.
Example
playground.ts
Last updated: Mon, Jun 15, 2026 09:49:35PM (UTC)
