Please enable JavaScript to use CodeHS

Color & Design

Color Picker Game

Computers describe colors with numbers. Can you match a color to its code? Play in RGB or hex mode and train your eye for digital color.

Design ~8 min Middle / High school
The Big Idea

How colors are coded

Every color on a screen is made by mixing red, green, and blue light. In the RGB model, each color channel is stored as a number from 0 (none) to 255 (full brightness).

Hexadecimal is a shorthand way to write the same RGB values. The hex color #FF5733 means red = 255, green = 87, blue = 51. Each pair of hex digits represents one color channel.

Simple definition: RGB uses three numbers for red, green, and blue. Hex writes those same three numbers as six digits in base 16.


Interactive

Try it: Color Picker Game

Below is the same kind of tool that powers the CodeHS Color Picker Game PowerUp. The target color is shown as a code. Click the swatch that matches. Use the button to switch between RGB and hex modes.

Color Picker Game
rgb(128, 64, 192)
Score: 0 / 0 Streak: 0 Level: 1 Time: 60s


How It Works

RGB vs hex

RGB and hex describe the same color in different notation. Both store the same three byte values.

ColorRGBHex
Redrgb(255, 0, 0)#FF0000
Greenrgb(0, 255, 0)#00FF00
Bluergb(0, 0, 255)#0000FF
Whitergb(255, 255, 255)#FFFFFF
Blackrgb(0, 0, 0)#000000

The game starts in RGB mode because the three numbers are easy to read. Once you are comfortable, switch to hex to practice the compact form that web developers use every day.


Real World

Why this matters

Color codes appear everywhere in digital design and development:

  • Web design: CSS uses hex and RGB to set text, background, and border colors.
  • Images: Every pixel in a PNG or JPEG stores red, green, and blue values.
  • Accessibility: Designers check contrast between color codes to make sure text is readable.
  • Games: Sprites and lighting effects are built from millions of RGB values.

Check Yourself

Quick quiz

1. What do the three numbers in rgb(255, 0, 0) represent?

2. How many hex digits describe a color in #RRGGBB?

3. Which color is darker: #000000 or #FFFFFF?

Keep exploring color and design

Color is one of the most visible parts of computing. You can learn more about hex, RGB, CMYK, color contrast, and how designers build palettes.

Part of the Color & Design tutorial series.