Colore JS

Search documentation

Find a function or jump to a section.
v1.4.4

analogousColors

Legacy documentation for Colore JS 1.4.4.View v2 docs

The analogousColors function finds the analogous colors of a given color. Analogous colors are those that are next to each other on the color wheel, providing a harmonious and visually appealing combination.

Syntax

analogousColors(color: string): string[]

Parameters

  • color (string): The input color string in any supported format (hex, rgb, hsl, etc.).

Returns

  • string[]: An array of analogous colors in the original format.

Throws

  • Error: Throws an error if the input color format is invalid.

Example

import { analogousColors } from 'colore-js';

const analogous = analogousColors('#ff0000');
console.log(analogous);
// Output: ['#ff8000', '#ff0080']

const analogousRgb = analogousColors('rgb(255, 0, 0)');
console.log(analogousRgb);
// Output: ['rgb(255, 128, 0)', 'rgb(255, 0, 128)']

Usage

The analogousColors function is used to generate colors that are visually harmonious and aesthetically pleasing, often used in design and art to create color schemes that are easy on the eyes.