Find a course

Module 1: How Color WorksLesson 2 of 1213 min

Color Models: RGB, HEX, HSL and CMYK

Learn how screens mix light with RGB, how HEX codes work, why HSL is easier for designers, and how printers mix inks with CMYK.

Step 1 of 12Learn

Additive color: RGB

Every pixel on your screen is made of tiny red, green and blue light sources. Turning them up and down in different combinations produces the colors you see. This is additive color mixing: the more light you add, the brighter the result.

  • Red + green = yellow
  • Green + blue = cyan
  • Blue + red = magenta
  • Red + green + blue at full strength = white
  • All off = black

That red plus green makes yellow surprises people who learned to mix paint. With light, you are adding wavelengths, not subtracting them.

In digital design, each channel usually has 256 levels, from 0 (off) to 255 (full). A color is written as three numbers: rgb(255, 0, 0) is pure red, rgb(255, 255, 255) is white and rgb(128, 128, 128) is a middle gray. With 256 levels per channel, there are 256 × 256 × 256 = 16,777,216 possible combinations, often described as "16.7 million colors."

RGB is the native language of screens: monitors, phones, TVs and projectors. Any design that will be viewed on a screen, including websites, apps, video and social posts, should be created in RGB.

Step 2 of 12Practice · Diagram

Additive mixing: overlapping red, green and blue light

Which overlap produces yellow on a screen?

Tap the shape that answers the question, then press Check.

Additive mixing: overlapping red, green and blue lightVenn diagram: Red, Green, Blue, Red + Green (overlap), Green + Blue (overlap), Red + Blue (overlap), Red + Green + Blue (overlap).RedGreenBlue• Yellow• Cyan• Magenta• White
Red
Green
Blue
Red + Green (overlap)

Red + green light = yellow. Surprising to painters, normal for screens.

  • Yellow
Green + Blue (overlap)
  • Cyan
Red + Blue (overlap)
  • Magenta
Red + Green + Blue (overlap)

All three at full strength: #FFFFFF.

  • White

Step 3 of 12Practice · Work it out

In 8-bit RGB, each channel has 256 levels. How many different colors can be described in total?

Step 4 of 12Learn

HEX codes

Web designers usually write RGB colors as hexadecimal (HEX) codes, such as #FF8800. A HEX code is simply the three RGB numbers written in base 16, two characters per channel: #RRGGBB.

Base 16 uses the digits 0–9 and then the letters A–F for 10–15. A two-character hex number can go from 00 (0) to FF (255). To convert, multiply the first character by 16 and add the second:

  • FF = 15 × 16 + 15 = 255
  • 88 = 8 × 16 + 8 = 136
  • C8 = 12 × 16 + 8 = 200
  • 00 = 0

So #FF8800 means red 255, green 136, blue 0: a bright orange. A few patterns help you read HEX codes at a glance:

  • When all three pairs are equal, the color is a gray: #333333 is dark gray, #CCCCCC is light gray.
  • The largest pair tells you the dominant hue: #2266DD is mostly blue.
  • Short codes like #F80 are shorthand for #FF8800: each character is doubled.

HEX and rgb() describe exactly the same colors; HEX is just more compact. Brand guides usually list both.

Step 5 of 12Practice · Choose one

What color does the HEX code #00CC00 describe?

Step 6 of 12Practice · Work it out

Convert the hex pair "B4" to a decimal number (0–255).

Step 7 of 12Learn

HSL: the designer-friendly model

RGB and HEX are perfect for machines but awkward for people. Quick: how do you make #3A7BD5 a little lighter and less saturated? Most designers cannot do that in their head.

HSL describes the same colors in terms people think in:

  • Hue (H): the position on the color wheel, in degrees from 0 to 360. Red is 0°, yellow 60°, green 120°, cyan 180°, blue 240°, magenta 300°, and back to red at 360°.
  • Saturation (S): how intense the color is, from 0% (gray) to 100% (full color).
  • Lightness (L): from 0% (black) through 50% (the pure hue) to 100% (white).

Now the edit is easy: hsl(215, 65%, 53%) → raise L to 63% for lighter, lower S to 45% for calmer. Hue stays put, so the color still feels like the same blue.

A close cousin, HSB or HSV (hue, saturation, brightness or value), is used in many design apps' color pickers. The idea is similar, though the numbers differ.

CSS accepts HSL directly, and modern CSS also supports newer models such as OKLCH, designed so that equal steps in lightness look more equal to the human eye. The principle stays the same: describe color by hue, intensity and lightness.

Step 8 of 12Try the calculator

Hue rotation helper

Enter a hue in degrees (0–360) to see where related hues sit on the wheel. The % operator wraps values past 360 back to the start.

Opposite hue (+180°)
30 °
Neighbor hue (+30°)
240 °
Neighbor hue (−30°)
180 °

Step 9 of 12Learn

Subtractive color: CMYK

Printing works the opposite way from screens. Paper does not emit light; it reflects room light. Inks act like filters, each absorbing (subtracting) some wavelengths and letting others bounce back. This is subtractive color mixing.

The printing primaries are cyan, magenta and yellow:

  • Cyan absorbs red light; magenta absorbs green; yellow absorbs blue.
  • Cyan + magenta = blue; magenta + yellow = red; yellow + cyan = green.
  • In theory, all three together absorb everything and give black. In practice they produce a muddy dark brown, and using that much ink soaks the paper.

So printers add a fourth ink, black, called K for "key" (the key plate that carried the detail). That gives CMYK. CMYK values are written as ink percentages, for example C 0, M 50, Y 100, K 0 for an orange.

Notice the neat relationship: the subtractive primaries (C, M, Y) are the additive secondaries, and the additive primaries (R, G, B) are the subtractive secondaries. The two systems are mirror images.

Because inks cannot reproduce every color a screen can show, especially very bright greens, blues and oranges, print designs should be converted to CMYK and proofed before printing.

Step 10 of 12Compare

Four ways to write a color

AspectRGBHEXHSLCMYK
Examplergb(255, 136, 0)#FF8800hsl(32, 100%, 50%)C0 M55 Y100 K0
MixingAdditive lightAdditive light (RGB in base 16)Additive light, described by people termsSubtractive ink
Best forScreens, codeWeb and CSSAdjusting colors by eyePrinting
Easy to tweak?HardHardEasy: change H, S or LPrinter-specific

Step 11 of 12Practice · Sort into groups

Sort each fact into the color model it describes.

Tap an item, then tap its group (or drag it there).

Step 12 of 12Practice · Choose one

A designer wants a slightly darker version of hsl(30, 90%, 55%) without changing the hue or intensity. Which edit is correct?