Graphics‎ > ‎Color‎ > ‎

RGB

To make a tank transparent paint it 255-0-255

In RGB a color is described by the amount of Red, Green and Blue light in it. RGB is a additive color model so when all the primary colors are at it's lowest value the color is black and when they all are at max the color is white. There are two main modes of RGB, direct color and indexed color.

Indexed color
In this mode the number stored in each pixel is a index into a palette. How many colors the palette can contain depends on the number of bits used for each pixel. If each pixel is a 8-bits in size one can index a palette of 256 colors and there can be no more then 256 different colors on the screen at the same time. The palette can be hard-coded for the hardware or modifiable. If it can be modified the colors in it works like some form of direct color mode.
  • 1-bit: 2 colors. Black and white.
  • 2-bit: 4 colors. CGA.
  • 4-bit: 16 colors. EGA.
  • 5-bit: 32 colors. Used on Amiga.
  • 6-bit: 64 colors. EHB mode on the Amiga with the limit that the second 32 colors are half brightness of the first 32.
  • 8-bit: 256 colors. VGA.
  • HAM: Hold-And-Modify is a display mode on the Amiga. It used 6-bit per pixel where 4 bits was used to select a color register. The two other bits was used to select if the color register was to be used or if the previous pixel was to be used and modified. It could only modify one channel at a time.
Direct color
In direct color mode the bits of the pixel directly encode the amount of red, green and blue.

Alpha
In direct color mode an alpha value can also be included for a pixel. The pixel is then a RGBA value and A is used for the alpha channel.  One common use for the alpha value is to be used as opacity. If alpha value is at it's lowest the pixel is fully transparent and at full value it is fully opaque. Values in between allow the background to show through. The alpha value and the color channels can be used for other effects when used in shaders. The order the channels are stored in a pixel can be described by changing the order of the letters. Common ones are RGBA and ARGB.

Color depth
The color depth is the number of bits used to describe a color. Within a color depth the amount of bits assigned to each color varies. The blue component sometimes gets less bit's then the others. To describe how many pixels each channel gets one write the number of bits for each channel after the letter for it. So R3G3B2 have 3 bits for red, 3 bits for green and 2 for blue for a total of 8 bits of color depth.
  • 8-bit
  • 12-bit: 4096 possible colors.
  • 16-bit:
  • 18-bit:
  • 24-bit:
  • 32-bit:


Comments