How does hexadecimal color work?

后端 未结 7 1725
刺人心
刺人心 2020-12-05 10:24

What does the hexadecimal that represents a CSS color mean? How can I tell what color it is without memorizing the exact code? Does it have any relationships with RGB (and C

7条回答
  •  借酒劲吻你
    2020-12-05 11:02

    In a six-digit hexadecimal notation, the digits pairwise indicate the red, green, and blue component in the RGB system. For example, #0000FF has 0 for red, 0 for green, and FF (which is 15 × 16 + 15 = 255 in decimal), i.e. the maximum, for blue (in the meaning it has in RGB).

    In the three-digit notation, each digit is doubled, and the result is interpreted as above. E.g., #00F means #0000FF.

    Authoritative reference: 4.3.6 Colors in CSS 2.1 (the newer CSS Values and Units Module Level 3 just normatively cites CSS 2.1 for this definition; there are extensions to the CSS color concept, but they do not affect these issues).

    RGB and CMYK are different color systems; there is no general conversion formula that converts between them.

提交回复
热议问题