Inferno, magma, plasma and viridis respectively
npm install scale-color-perceptual
const scale =0 025 05 075 1 // Spits out the colors at the given points
scale.viridis(t), all taking scale parameter
t in the range
If a number is given outside this range is given an
Error will be thrown.
Each of the scales has been put in the root of the module allowing you to import only the scale you need, yielding a smaller JS file:
const viridis =0 025 05 075 1 // Spits out the colors at the given
It can also be used with D3:
const d3 =const plasma =const depthScale = d3scale // default range is [0, 1]// Make sure the output is constrained to [0, 1]d3datad3stylewidth: '10px'height: '10px'float: 'left'
You can also import the raw color maps, either as
rgb triplets (
[r, g, b], where
c is in
const d3 =const plasmaMap = // returns 256 hex colors from dark to brightconst colorScale = d3scale
rgb/ contains raw JSON exports of the pixel
[r, g, b] triplets
bids/colormap, which are the default color scales in matplotlib 2.0.
The pixel triplets were obtained from
bids/colormap#84cb377. To build the
hex/ files, run
All credits go to Stéfan van der Walt and Nathaniel Smith for their work devising these color scales. Remember to watch their talk on how it was derived and how it is better than other common scales
The code in this repository is licensed under ISC