RGB is a three-channel format containing data for red, green, and blue. RGBA is a 4-channel format containing data for Red, Green, Blue and Alpha.
For the alpha channel, there is no need to use the color transparent / opaque (or partially transparent, translucent).
In CSS, rgb () had extensive browser support for several years before rgba () received the same level of support. This is one of the reasons you will find more rgb () in CSS than rgba (). Another reason is that transparency is not something you usually use everywhere.
You can find an RGB value packed in 16 bits, with 5 bits for blue and red and 6 bits for green (green gets more bits because the eye is more perceptive for shades of green). You can also find the RGBA value packed in 16 bits, with 5 bits for each color and 1 bit for alpha. With one bit, you can make the color completely transparent or not transparent at all.
Usually at present you will find RGB and RGBA packed in 32-bit values, with 8 bits for each color and 8 bits for alpha (or left blank for RGB).
In CSS, designers decided to use values 0-255 (range for an 8-bit value) for red, green, and blue, but they use a value between 0.0 and 1.0 for the alpha channel. The actual byte format for color is not relevant to web developers.
In my experience, neither Rgb () nor rgba () are used very often in CSS. Hake colors are more dominant and precede a few more years.
HSL is actually a much better format for working with colors and is supported in CSS (IE9 +, Firefox, Chrome, Safari, and Opera 10+.).
http://www.w3schools.com/cssref/css_colors_legal.asp
Rich Remer Jul 02 '14 at 18:46 2014-07-02 18:46
source share