Skip to content
Module: Code Logic

How It Works

Even though the program is written in code, the actual logic flows like a recipe. Here is the step-by-step path the computer takes from start to finish.

The Photographer Analogy

"Think of this like a professional photographer: they wait for the right moment, take multiple shots in burst mode, throw away the blurry ones, color-correct the best, and then publish. Your Colour Picker does exactly the same thing — with light instead of photos!"

The 7-Step Pipeline

CAPTURE
CLEAN
OUTPUT
CAPTURE
1

Wait for Command

The computer waits patiently until you press "S" to scan.

2

Adjust to Lighting

The sensor checks brightness and adjusts sensitivity — like pupils adapting to light.

3

Collect Data

Takes five rapid readings of the color for accuracy.

CLEAN
4

Clean the Data

Sorts readings, discards highest and lowest, averages the middle three.

5

Translate for Eyes

Applies gamma correction so sensor numbers match human perception.

6

Make Colors Pop

Boosts saturation so colors look vivid, not washed out.

OUTPUT
7

Announce Result

Prints exact RGB and HEX codes, then loops back to Step 1.

↻

Loop back to Step 1 — waiting for the next scan command.

Key Takeaway

The entire pipeline boils down to three phases: Capture (Steps 1-3), Clean (Steps 4-6), and Output (Step 7). Every color measurement goes through all three!

Try It!

Try scanning the same object in different lighting conditions. Notice how auto-ranging (Step 2) adapts automatically? The final color should stay remarkably consistent!