Labs ICT
โญ Pro Login

Color Models

RGB, HSV, CMYK and other color representations

Color Models

Color models define how colors are represented numerically. Different models serve different purposes in computer graphics, from display to printing to artistic work.

RGB (Red, Green, Blue)

An additive color model used for electronic displays. Colors are created by combining red, green, and blue light at varying intensities.

RGB Color Cube:
        (1,1,1) White
        /|\
       / | \
      /  |  \
     /   |   \
(1,0,0)  |  (0,1,0)
 Red      |   Green
     \   |   /
      \  |  /
       \ | /
        \|/
        (0,0,0) Black

Each channel: 0-255 (8-bit)
Total colors: 256 x 256 x 256 = 16,777,216

Example: Bright yellow = (255, 255, 0)
         Dark blue    = (0, 0, 128)

HSV (Hue, Saturation, Value)

A more intuitive model for humans. Hue represents the color type (0-360 degrees), Saturation represents vividness (0-100%), and Value represents brightness (0-100%).

HSV Cylinder:

        Hue (0-360)
          ^
          |    Red (0)
          |   /  \
          |  /    \
          | /  Sat \
          |/--------\
          +-----------> Saturation (0-100%)
         /
        /
       v
    Value (0-100%)

RGB to HSV conversion:
  H = angle on the color wheel
  S = chroma / max(R,G,B)
  V = max(R,G,B)

CMYK (Cyan, Magenta, Yellow, Key/Black)

A subtractive color model used for printing. Colors are created by absorbing light rather than emitting it. The K (Key) channel adds true black.

CMYK (Subtractive):
  C = Cyan    = absorbs Red
  M = Magenta = absorbs Green
  Y = Yellow  = absorbs Blue
  K = Black   = absorbs all

RGB to CMYK:
  C = 1 - R
  M = 1 - G
  Y = 1 - B
  K = min(C, M, Y)

Alpha Channel

An additional channel representing opacity. RGBA adds transparency to RGB colors, enabling blending and compositing effects.

RGBA blending:
  result = src * alpha + dest * (1 - alpha)

  (255,0,0,128) = semi-transparent red
  (0,255,0,255) = fully opaque green

๐Ÿงช Quick Quiz

What are the primary colors in the RGB color model?