getSplitComplementary()
The getSplitComplementary
function allows you to generate split complementary
colors based on a given Spectrum
instance. If you are not familiar with the
term, you may find useful this article:
โWhat Are Split-Complementary Colors? Best Ways to Use This Color Schemeโ.
Usage
import Spectrum, { getSplitComplementary } from '@snipshot/spectrum';
const cyan = new Spectrum('hsl', [180, 1, 0.5]);
const { secondary, tertiary } = getSplitComplementary(cyan);
console.log(secondary.hsl); // { h: 330, s: 1, l: 0.5, a: 1 } - roseconsole.log(tertiary.hsl); // { h: 30, s: 1, l: 0.5, a: 1 } - dark orange
Parameters
getSplitComplementary(colorObj)
Parameter | Type | Required | Description |
---|---|---|---|
colorObj | Spectrum instance | true | The base color for complementary colors generation |
Return Value
The getSplitComplementary
function returns a an object with two keys:
secondary
and tertiary
, the generated split complementary colors for the
given one. The values are instances of Spectrum
class.
type Return = { secondary: Spectrum; tertiary: Spectrum;};