Skip to main content

Getting Started with color-core

Let's get you up and running with color-core quickly.

Installation

Install color-core using npm:

npm install color-core

Basic Usage

First, let's create a new Color object:

import { Color } from 'color-core';

const purple = new Color('#B05BFF');

Now, let's explore what we can do with it:

Click the color below to change it:

Hex: #b05bff

Converting to RGB

You can easily convert the color to RGB format:

const rgbColor = purple.toRgb();

Try changing the color:

RGB: {"r":176,"g":91,"b":255,"a":1}

Adjusting Lightness

You can make the color lighter or darker:

const lightpurple = purple.adjustLightness(10);

Current color: #b05bff

Generating Color Harmonies

You can generate a triadic color scheme:

const [color1, color2, color3] = purple.triadic();

Change the base color to see triadic harmony:

Triadic colors: #b05bff, #ffb05c, #5cffb0

That's it! You've now created colors, converted between formats, manipulated colors, and generated color harmonies using color-core.

Explore the rest of the documentation to learn more about color-core's capabilities.