Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.gamma(0.7)
.lightness([0.3, 0.8])
.scale() // convert to chroma.scale
.correctLightness()
.colors(5);
chroma.scale('RdYlBu');
chroma.scale('RdYlBu').padding(0.15);
chroma.scale('OrRd');
chroma.scale('OrRd').padding([0.2, 0]);
chroma.scale('OrRd').classes(5);
chroma.scale('OrRd').classes(8);
myChroma.cubehelix()
.start(200)
.rotations(-0.35)
.gamma(0.7)
.lightness([0.3, 0.8])
.scale() // convert to chroma.scale
.correctLightness()
.colors(5);
myChroma.scale('RdYlBu');
myChroma.scale('RdYlBu').padding(0.15);
}
function palette() {
// prettier-ignore
return chroma
.cubehelix()
.start(randomNumber(0, 360))
.rotations(-0.35)
.gamma(0.7)
.lightness([0.4, 0.8])
.scale()
.correctLightness()
.colors(DEPTH + 2);
}
function randomColor() {
// prettier-ignore
return chroma.cubehelix()
.start(range(0, 360))
.rotations(-0.5)
.gamma(0.8)
.lightness([0.3, 0.8])(range(0, 1));
}
prepareColors(l1, l2){
//const colors = chroma.scale(['#fafa6e','#2A4858']).mode('lch').colors(l1);
const colors = chroma.cubehelix().start(200).rotations(-0.35).gamma(0.7).lightness([0.7, 1]).scale().correctLightness().colors(l1);
//const sub_colors = chroma.scale(['#1a75ff', 'grey']).mode('lch').colors(l2);
//const sub_colors = chroma.scale('OrRd').colors(l2);
//const sub_colors = chroma.cubehelix().start(200).rotations(-0.35).gamma(0.7).lightness([0.4, 0.85]).scale().correctLightness().colors(l2);
//const sub_colors = chroma.scale(['green', 'yellow', 'teal', 'blue']).mode('lch').colors(l2)
let rc, sub_colors = [];
for(let i=1; i<= l2; i++){
rc = chroma.random();
sub_colors.push(rc);
}
return [colors, sub_colors];
}
renderTooltip(xLabel, yLabel, params){
/**
* Color function transfer management.
* Requires chroma.js
*/
//var colormaps = function(){
var chroma = require("chroma-js");
const svgNS = "http://www.w3.org/2000/svg";
var tables = {
Default: [[0,1],[0,1],[0,1]], //[[1,1,1],[0.93,0.001,0],[0.63,0.001,0]],
OrRd: tableFromChroma(chroma.brewer.OrRd),
PuBu: tableFromChroma(chroma.brewer.PuBu),
Oranges: tableFromChroma(chroma.brewer.Oranges),
Greens: tableFromChroma(chroma.brewer.Greens),
CubeHelix: tableFromChroma(chroma.cubehelix().scale().correctLightness().colors(9)),
InvertedGrayscale: [[1,0.01,0],[1,0.01,0],[1,0.01,0]],
Identity: [[0,1],[0,1],[0,1]]
};
function tableFromChroma(chromaTable){
var rtab = [];
var gtab = [];
var btab = [];
chromaTable.forEach(function(chromaElt){
var rgb = chroma(chromaElt).get('rgb');
rtab.push(rgb[0]/255);
gtab.push(rgb[1]/255);
btab.push(rgb[2]/255);
});
CUBEHELIX.map((x, i) => (
))}