Colore JS

Search documentation

Find a function or jump to a section.
v2.0.1

Immutability and chaining

Start with a brand color and you can derive several states from it. Each edit returns a new Color, so the default state remains available.

Derive hover and pressed colors

import { colore } from 'colore-js';

const brand = colore('#2563eb');
console.log(brand.lighten(8).hex()); // '#306ff8'
console.log(brand.darken(8).hex()); // '#1855dc'
console.log(brand.hex()); // '#2563eb'

Keep a reference to the value a method returns if you want to reuse that edit.

Chain several edits before writing CSS

import { colore } from 'colore-js';

const brand = colore('#2563eb');
console.log(brand.darken(8).saturate(6).hex()); // '#1052e3'

The chain keeps the channels numeric until hex() runs. If you pass a CSS string from one standalone transform to the next, the second step reads that already-rounded string.

Import a helper for one operation

import { lighten } from 'colore-js/fn';

console.log(lighten('#2563eb', 8)); // '#306ff8'

The function returns CSS, ready to use in a style rule or theme value.