Update 'palette-gen.js'
This commit is contained in:
parent
1563bb0815
commit
8825bd0f75
@ -1,7 +1,7 @@
|
||||
#!/bin/nodejs
|
||||
|
||||
const componentToHex = (c) => ("0" + c.toString(16)).slice(-2);
|
||||
const rgbToHex = (c) => "#" + componentToHex(c.r) + componentToHex(c.g) + componentToHex(c.b);
|
||||
const rgbToHex = (c) => componentToHex(c.r) + componentToHex(c.g) + componentToHex(c.b);
|
||||
const hexToRgb = (hex) => {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
@ -31,5 +31,5 @@ const rl = readline.createInterface({
|
||||
});
|
||||
|
||||
rl.on('line', (line) => {
|
||||
console.log(parseScheme(line).map(e=>genPalette(e).map(c=>rgbToHex(c))));
|
||||
console.log(parseScheme(line).map(e=>genPalette(e).map(c=>rgbToHex(c))).join(","));
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user