0
Can someone help me answer this please.
How to create a page that allows user to convert RGB color format to hex. Using html and plain js with no css
3 Réponses
+ 3
Why no css? Please link your code!
If you need some inspiration, you can go to "Code" section and search for "color converter"
+ 3
To convert decimal to hex, you can call the toString method
x = 255
console.log(x.toString(16))
Therefore,
const color = [255, 60, 255]
const toHex = (hex, val) => hex + val.toString(16)
console.log(color.reduce(toHex, '#'))