Can someone help me answer this please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

22nd Sep 2021, 12:36 PM
Sheriff Kora
Sheriff Kora - avatar
3 Answers
+ 3
Why no css? Please link your code! If you need some inspiration, you can go to "Code" section and search for "color converter"
22nd Sep 2021, 12:41 PM
Lisa
Lisa - avatar
+ 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, '#'))
22nd Sep 2021, 1:03 PM
Ore
Ore - avatar
0
Thank you all, Lisa and Ore
22nd Sep 2021, 3:02 PM
Sheriff Kora
Sheriff Kora - avatar