Color Elements

Color Elements

These are some highly experimental color-related web components. Use at your own risk, the API can change at any point.

All elements

A screenshot showcasing the <color-picker> color element

<color-picker>

Select and adjust colors in any color space using sliders and input fields.

A screenshot showcasing the <color-scale> color element

<color-scale>

Display a list of colors. Primarily intended for color palettes.

A screenshot showcasing the <color-chart> color element

<color-chart>

Display lists of colors as a scatterplot or line chart.

A screenshot showcasing the <color-swatch> color element

<color-swatch>

Display a visual representation of a color alongside the info about it.

A screenshot showcasing the <color-inline> color element

<color-inline>

Display a color swatch alone or alongside its textual representation.

A screenshot showcasing the <channel-slider> color element

<channel-slider>

Display a <color-slider> for a specific channel.

A screenshot showcasing the <color-slider> color element

<color-slider>

Display a slider with a gradient background. Primarily intended for color picking.

A screenshot showcasing the <gamut-badge> color element

<gamut-badge>

Gamut indicator. Used internally by <color-swatch>.

A screenshot showcasing the <channel-picker> color element

<channel-picker>

Select individual color channels within a specified color space.

A screenshot showcasing the <space-picker> color element

<space-picker>

Select a color space from a list of predefined or custom color spaces.

Upcoming

<color-plane>

Usage

CDN

To include all components at once:

<script src="https://elements.colorjs.io/index.js" type="module"></script>

To cherry-pick individual components, follow the instructions within the component’s page, but it generally looks like this:

<script src="https://elements.colorjs.io/src/COMPONENT_NAME/COMPONENT_NAME.js" type="module"></script>

Each component imports its own dependencies and styles.

NPM

As usual:

npm i color-elements

and then:

import "color-elements";

You can also import individual components:

import "color-elements/COMPONENT_NAME";