Skip to content

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 } - magenta
console.log(tertiary.hsl); // { h: 60, s: 1, l: 0.5, a: 1 } - yellow

Parameters

getTriadic(colorObj)

ParameterTypeRequiredDescription
colorObjSpectrum instancetrueThe 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];