From 8825bd0f75bb87175ba9f970a6c73608404daebc Mon Sep 17 00:00:00 2001 From: sora Date: Sat, 17 Jun 2023 02:42:25 +0200 Subject: [PATCH] Update 'palette-gen.js' --- palette-gen.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/palette-gen.js b/palette-gen.js index 6524d41..c565814 100644 --- a/palette-gen.js +++ b/palette-gen.js @@ -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(",")); });