convert to 3-digit hex color code

后端 未结 4 583
[愿得一人]
[愿得一人] 2020-12-19 00:08

I\'ve been using 3-digit hex color values in CSS for a long time: #fff, #999, #069, etc. I can see how the repeating letters/numbers a

4条回答
  •  悲哀的现实
    2020-12-19 01:00

    #f0f is expanded to #ff00ff so basically you just need to calculate the value and the value times 16 for each character, e.g.:

    #f98: f = 15 => red = 15 + 15*16 = 255 etc.

提交回复
热议问题