Skip to content

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 } - rose
console.log(tertiary.hsl); // { h: 30, s: 1, l: 0.5, a: 1 } - dark orange

Parameters

getSplitComplementary(colorObj)

ParameterTypeRequiredDescription
colorObjSpectrum instancetrueThe base color for complementary colors generation

Return Value

The colorMix 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;
};