RGBA stands for red green blue alpha
and is sometimes described as a color space. However, it is actually a three-channel RGB color model supplemented with a fourth alpha channel.
Alpha indicates how opaque each pixel is and allows an image to be combined over others using
rgba(red, green, blue, alpha)
The alpha value is declared as a decimal number from 0 to 1, where 0 is fully transparent and 1 is fully opaque.
RGBA is a four-channel format containing data for Red, Green, Blue, and an Alpha value.
The CSS function rgba()
may have limited support in older browsers.
The opacity of the color can be easily controlled by specifying the opacity in terms of a parameter.
Example: The rgba(255, 0, 0, 0.3)
defines the red color with opacity set to 0.3.
In many systems with more than 8 bits per channel (such as 16 bits or floating-point), the channels are stored in RGBA order, even if 8-bit channels are stored in some other order.
In some software originating on big-endian machines, colors were stored in 32-bits similar to ARGB32, but with the alpha in the bottom 8-bits rather than the top. For example: 808000FF would be Red and Green: 50.2%, Blue: 0% and Alpha: 100% (a brown). This is what you would get if RGBA8888 data was read as words on these machines.
The channels are arranged in memory in such a manner that a single 32-bit unsigned integer has the alpha sample in the highest 8-bits, followed by the red sample, green sample, and finally the blue sample in the lowest 8 bits:
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 channels, 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).
The first FF in the 80FFFF00 value 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.
This layout became popular when 24-bit color (and 32-bit RGBA) was introduced on personal computers. At the time it was much faster and easier for programs to manipulate one 32-bit unit than four 8-bit units.
Free Resources