How can I check all the hexadecimal color values that are present in css? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I check all the hexadecimal color values that are present in css?

Can I check all the hexadecimal color values present in css by a program or code or something else? I didn't understand much in the CSS Course about Hexadecimal values of colors, so I am just asking if I can know all of them. I am making a program for that.👇 https://code.sololearn.com/WpEom2mCEC1e/?ref=app

21st Jan 2021, 1:12 PM
Ezra Bridger 2207 [INACTIVE]
Ezra Bridger 2207 [INACTIVE] - avatar
2 Answers
+ 2
Check this out you will get one random color from all the possible colors that can be form through hex codes. // JS CODE: function get_color() { var letters = '0123456789ABCDEF'.split(''); var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.round(Math.random() * 15)]; } return color; } window.onload = (event) => { var colour = get_color(); document.body.style.backgroundColor = colour; console.log(colour); };
21st Jan 2021, 1:29 PM
Rohit
+ 1
RKK Thanks for the answer😊
21st Jan 2021, 1:31 PM
Ezra Bridger 2207 [INACTIVE]
Ezra Bridger 2207 [INACTIVE] - avatar