Skip to content

Instantly share code, notes, and snippets.

@jaybo
Created December 10, 2017 06:28
Show Gist options
  • Save jaybo/98d21dc2012d89b8c20c5a9bfe17922e to your computer and use it in GitHub Desktop.
Save jaybo/98d21dc2012d89b8c20c5a9bfe17922e to your computer and use it in GitHub Desktop.
make_colormap.js
let colormap = require('colormap')
var fs = require('fs');
let map_name = 'bluered';
let file_name = map_name + ".json"
let colors = colormap({
colormap: map_name,
nshades: 100,
format: 'hex',
alpha: [1.0, 0.5, 1.0]
})
var json_text = JSON.stringify(colors);
fs.writeFile(file_name, json_text, function(err) {
if(err) {
return console.log(err);
}
console.log("Created " + file_name);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment