androidcolor-codes

android 8-code color scheme


I have seen some strange color codes used for android. I am used to RGB color codes such as

<color name="white">#ffffff</color>

Here you notice 6 hex values. However, some android color codes use 8 like so

<color name="red">#ffff0000</color>

I guess the extra two hex values are for transparency.

Is it the starting 2 or the ending 2 hex values that represent transparency? Also, does ff mean transparent and 00 opaque or vice versa? The closest thing I could find on http://android.com was this. Links to resources will be appreciated.

Thanks.


Solution

  • You guessed right! The extra two digits are for transparency, and this format is called aRGB.

    As evident from the name, the beginning two digits represent the alpha (or transparency) value, with 255 (ff) being fully opaque and 0 (00) being fully transparent.