colormap
Advanced tools
Comparing version 1.2.2 to 1.3.0
19
index.js
@@ -26,13 +26,18 @@ /* | ||
colormap = spec.colormap || 'jet'; | ||
nshades = spec.nshades || 72; | ||
format = spec.format || 'hex'; | ||
if (!spec.colormap) colormap = 'jet'; | ||
colormap = colormap.toLowerCase(); | ||
if (typeof spec.colormap === 'string') { | ||
colormap = spec.colormap.toLowerCase(); | ||
if (!(colormap in colorScale)) { | ||
throw Error(colormap + ' not a supported colorscale'); | ||
if (!(colormap in colorScale)) { | ||
throw Error(colormap + ' not a supported colorscale'); | ||
} | ||
cmap = colorScale[colormap]; | ||
} else if (Array.isArray(spec.colormap)) { | ||
cmap = spec.colormap; | ||
} | ||
cmap = colorScale[colormap]; | ||
nshades = spec.nshades || 72; | ||
format = spec.format || 'hex'; | ||
@@ -39,0 +44,0 @@ if (cmap.length > nshades) { |
{ | ||
"name": "colormap", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Easily output great looking predefined hex or rgb color maps", | ||
"author": "bpostlethwaite", | ||
"dependencies": { | ||
"arraytools": "^1.0.0" | ||
"arraytools": "^1.0.0", | ||
"tinycolor2": "^1.0.0" | ||
}, | ||
@@ -9,0 +10,0 @@ "devDependencies": { |
63678
156
2
+ Addedtinycolor2@^1.0.0
+ Addedtinycolor2@1.6.0(transitive)