Clone this wiki locally
Wiki ▸ Predefined 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:
chroma.colors.azure // "#f0ffff" chroma.color('azure').hex() // "#f0ffff" chroma.scale(['wheat', 'maroon']);
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 // #f7fcb9 chroma.scale('RdYlBu', chroma.limits(data, 'equal', 11));
Here's a view of all included colors and color scales: