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

前端 未结 5 1464
广开言路
广开言路 2020-12-05 03:31

I sometimes have seen in examples where the coloring in Android is done as #FF191919. I mean a 8 digit hex number . But it should be only a 6 digit number. How are they rela

相关标签:
5条回答
  • 2020-12-05 04:12

    The extra 2 digits are used to define the colors transparency, or alpha channel.

    Android uses the ARGB format (or AARRGGBB as you use in your example)

    For more (Android-specific) information take a look at the Color documentation

    0 讨论(0)
  • 2020-12-05 04:19

    AN 8 digit Android HEx is called an aRGB. aRGB values are typically expressed using 8 hexadecimal digits, with each pair of the hexadecimal digits representing the values of the Alpha, Red, Green and Blue channel, respectively. For example 80FFFF00 represents 50.2% opaque (non-premultiplied) yellow. The 80 hex value, which is 128 in decimal, represents a 50.2% alpha value because 128 is approximately 50.2% of the maximum value of 255 (FF hex); to continue to decipher the 80FFFF00 value, the first FF represents the maximum value red can have; the second FF is like the previous but for green; the final 00 represents the minimum value blue can have (effectively – no blue). Consequently red + green yields yellow. In cases where the alpha is not used this can be shortened to 6 digits RRGGBB, this is why it was chosen to put the alpha in the top bits. Depending on the context a 0x or a number sign (#)[1] is put before the hex digits.

    0 讨论(0)
  • 2020-12-05 04:22

    the 8 digit color define with alpa level

    let extract all we define hex color as 6 value pair of rgb 2 digit per

    1st 2 digit for red, 2nd 2 digit for green and 3rd 2 digit for blue now if you want to set the alpha level of that then it define with the 8 digit as ARGB so, now 1st 2 digit value was define for the alpha and rest are for the RGB

    0 讨论(0)
  • 2020-12-05 04:24

    The first two characters are representing the alpha (transparency) value, where FF is fully visible. This is known as aRGB.

    0 讨论(0)
  • 2020-12-05 04:34

    8-digit hex is an ARGB color. It is the same as usual RGB, but provides an extra alpha channel.

    #RRGGBB in RGB is the same as #00RRGGBB in ARGB. Also take a look at Color.argb.

    0 讨论(0)
提交回复
热议问题