Chroma.jsJavaScript 颜色处理库
Chroma.js 是一个微型的 JavaScript 库 (8.5kb) 可实现各种颜色的转换和颜色处理。
使用方法:
Initiate and manipulate colors:
chroma('#D4F880').darken().hex(); // #9BC04B
Working with color scales is easy, too:
scale = chroma.scale(['white', 'red']); scale(0.5).hex(); // #FF7F7F
Lab/Lch interpolation looks better than than RGB
chroma.scale(['white', 'red']).mode('lab');
Custom domains! Quantiles! Color Brewer!!
chroma.scale('RdYlBu').domain(myValues, 7, 'quantiles');
And why not use logarithmic color scales once in your life?
chroma.scale(['lightyellow', 'navy']).domain([1, 100000], 7, 'log');
评论