Skip to content

Predefined Colors

arya-s edited this page Dec 7, 2014 · 12 revisions

WikiPredefined Colors

Chroma.js now includes a set of named colors and color scales. To include them you need to load the chroma.colors.js into your project.

<script src="chroma.min.js"></script>
<script src="chroma.colors.js"></script>

The named colors are defined by the W3C as X11 Colors. Besides accessing them directly you can basically use the named colors instead of the hexadecimal strings:  // "#f0ffff"
chroma.color('azure').hex() // "#f0ffff"
chroma.scale(['wheat', 'maroon']);

wheat maroon gradient

The color scales are taken from ColorBrewer, a lovely collection of hand-picked color scales. Note that, depending on how you configure the color scale, eventually colors will be interpolated.

chroma.brewer.YlGn[1] // #f7fcb9

chroma.scale('RdYlBu', chroma.limits(data, 'equal', 11));


Here's a view of all included colors and color scales:

named colors and colorbrewer scales

Something went wrong with that request. Please try again.