55.6k views
4 votes
The colors seen on a computer screen consist of combinations of the primary colors red​ (R), green​ (G), and blue​ (B). The intensity of each of the three ranges from 0 to 255. This allows 2553=​16,581,375 distinct colors​ (at least​ theoretically), where a particular​ color's designation may require up to 9 digits. For​ example, the​ (R, G,​ B) designation for black is​ (0, 0,​ 0), while white is​ (255, 255,​ 255), and gray is​ (128, 128,​ 128). But the colors are coded in HTML​ (HyperText Markup​ Language) in​ hexadecimal, so each primary color intensity then requires no more than two digits 255=FFsixteen. White is coded​ FFFFFF, and black is 000000. Give a similar HTML code for the color gray.

1 Answer

6 votes

All you need to do is convert 128 (base 10) to base 16.

We have

128 = 8*16 + 0

so

128 (base 10) = 80 (base 16)

which means gray is encoded as 808080 in HTML.

User Bouzid Zitouni
by
5.3k points