Getting Started

Install Culori from npm

Add Culori as a dependency to your project:

npm install culori

Then start using it:

import { rgb } from 'culori';

rgb('tomato');
// ⇒ Object { mode: "rgb", r: 1, g: 0.38823529411764707, b: 0.2784313725490196 }

Fetch Culori from a CDN

You can use Culori from your favorite Content Delivery Network to create quick prototypes in HTML. Here are a few popular choices:

CDN URL
unpkg https://unpkg.com/culori
jsDelivr https://cdn.jsdelivr.net/npm/culori
skypack https://cdn.skypack.dev/culori

Use it as an ES module:

<script type='module'>
import { rgb } from 'https://cdn.skypack.dev/culori';
console.log(rgb('salmon'));
</script>

...or using a traditional <script> tag. The library will be made available under the culori global variable:

<script src="https://unpkg.com/culori"></script>
<script>
console.log(culori.rgb('salmon'));
</script>

Use Culori online

In your browser's console

The library is added to every page of this website, so you can try the API in your browser's console as you read through the examples.

Runkit

You can also use Culori in the Runkit npm playground (npm.runkit.com/culori) to test the API without installing anything.

Observable

If you prefer to see the results visually, Observable is a great place to tinker with the library.

Add this cell and you're good to go:

culori = import('culori@2.0.3');

It's often useful to pin the library to a specific version, to make sure your old notebooks don't break if the API changes in a new major version of the library.

Use Culori in Deno

The library is published to deno.land/x/culori for usage in Deno:

import { rgb } from 'https://deno.land/x/culori@2.0.3/index.js';

rgb('tomato');