18

I want to pick up the color #FFEAF0FF from the Visual Studio color scheme to Visual Studio Code:

Screenshot of three colour swatches with hexadecimal colour codes; the one mentioned shows as light blue

But when I put this hexadecimal code into Visual Studio Code, it becomes a different color:

Screenshot of Visual Studio Code configuration showing light pink

They are totally different colors (light blue vs light pink), so how can I make #FFEAF0FF display the right color in the six-digit format?

0

1 Answer 1

59

Strip off the leading FF.

Wherever you got that 8-hex-digit color from (an Android app, I'm guessing?), appears to be using an "ARGB" color scheme, where the first pair of hex digits represents the "alpha channel" (basically the opacity value).

Traditional web hex colors just use 6-hex-digit RGB, but about 4 years ago, browsers started supporting 8-hex-digit color codes in the "RGBA" format. Unlike Android's "ARGB", the emerging web standard's use of the "RGBA" format puts the alpha channel in the more compatible place at the trailing end of the color code (I'm not sure why Android chose ARGB instead of RGBA). 8-hex-digit RGBA web color codes are in the process of being standardized as part of "CSS Color Module, Level 4".

9
  • 3
    Great answer! This Stack Overflow answer basically states the same, but with a few more details. Feb 27, 2022 at 5:32
  • 24
    8-hex-digit is also valid web color (CSS), but it's RRGGBBAA.
    – Kaiido
    Feb 27, 2022 at 23:23
  • 8
    @JW0914 You got it backwards. OP wanted light blue, but got pink, because he was coming from a tool that used ARGB, and going to a tool that used RGB[A]. The leading FF was the issue, not the trailing one.
    – Spiff
    Feb 28, 2022 at 15:48
  • 3
    Note that #RGBA started out being supported by most graphic editing tools long before browsers supported it. Browsers implemented #RGBA because it was the de-facto standard
    – slebetman
    Mar 1, 2022 at 9:04
  • 2
    #AARRGGBB makes some sense in that you can just parse the digits as a 32-bit number, and then only look at the low three bytes / low 24 bits to get the RGB values. The RGB values end up in the same bit positions as with just #RRGGBB. With the options being #RRGGBBAA and #RRGGBB, the low byte would be BB in one and AA in the other. (Though I guess it would make more sense if AA=00 would be normal non-transparent color instead of the other way around. Then you could just treat #RRGGBB the same as #00RRGGBB even more all the way. Well, I probably miss something, but anyway.)
    – ilkkachu
    Mar 1, 2022 at 10:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .