Hex Colors in Android several times 8 digits. How? What is the difference between #FFFFFF and # FFFFFF00

I sometimes saw in examples where the coloring in Android is done as # FF191919. I mean an eight-digit hexadecimal number. But it should only be a 6-digit number. How are they connected? If I want o convert a 6 digit number to an 8 digit number. How to do it? I mean convert # 424242 to 8 digit digital coloring? Please let me know the details. Thanks for your time and help.

+61
android android-layout colors android-canvas hex
Aug 02 2018-11-11T00:
source share
5 answers

The additional 2 digits are for transparency, mainly indicated by AA (alpha channel). See the documentation for more information.

+80
Aug 02 2018-11-11T00:
source share

The first two characters represent the alpha (transparency) value, where FF fully displayed. This is called aRGB.

+39
Aug 02 2018-11-11T00:
source share

The 8-digit hex is the color of ARGB . It is usually similar to RGB , but provides an additional alpha channel.

#RRGGBB in RGB is the same as # 00RRGGBB in ARGB. Also see Color.argb .

+11
Aug 02 2018-11-11T00:
source share

8-digit color determined by alpa level

let's extract everything, we define the hexadecimal color as a 6-digit pair rgb 2 digits per

The 1st 2-digit digit for red, the 2nd 2-digit digit for green and the 3rd 2-digit digit for blue now if you want to set the alpha level, which is then identified with an 8-digit number as ARGB, so now the 1st two-digit value has been defined for alpha and the rest for RGB

+6
Aug 02 2018-11-11T00
source share

AN 8-bit Android HEx is called aRGB. ARGB values ​​are usually expressed using 8 hexadecimal digits, each pair of hexadecimal digits representing the Alpha, Red, Green, and Blue channel values, respectively. For example, 80FFFF00 represents a 50.2% opaque (without preliminary multiplication) yellow color. A hexadecimal value of 128 in decimal represents a value of 50.2% alpha, since 128 is approximately 50.2% of the maximum value of 255 (FF hex); to continue decoding the value 80FFFF00, the first FF represents the maximum value that may be red; the second FF is similar to the previous one, but to green; the final value of 00 is the minimum value that blue can have (in fact, not blue). Therefore, red + green gives a yellow color. In cases where alpha is not used, this can be reduced to 6 digits RRGGBB, so it was chosen to put alpha in the upper bits. Depending on the context, a 0x sign or a number (#) [1] is placed before the hexadecimal digits.

+3
Nov 22 '15 at 12:01
source share



All Articles