getTriadic()
The getTriadic
function allows you to generate triadic colors combination
based on a given Spectrum
instance. If you are not familiar with the term, you
may find useful this article:
โWhat Are Triadic Colors and How Are They Used? Triadic Color Schemes Explainedโ.
Usage
import Spectrum, { getTriadic } from '@snipshot/spectrum';
const cyan = new Spectrum('hsl', [180, 1, 0.5]);
const [secondary, tertiary] = getTriadic(cyan);
console.log(secondary.hsl); // { h: 300, s: 1, l: 0.5, a: 1 } - magentaconsole.log(tertiary.hsl); // { h: 60, s: 1, l: 0.5, a: 1 } - yellow
Parameters
getTriadic(colorObj)
Parameter | Type | Required | Description |
---|---|---|---|
colorObj | Spectrum instance | true | The base color for triadic colors generation |
Return Value
The getTriadic
function returns a an Array
with two
Spectrum
instances, that are triadic colors for the
given one.
type Return = [Spectrum, Spectrum];