A pixel is three numbers: how many colours so many levels give, bits per pixel, counting in base 16, web colour codes, and light that adds up.
Step 1 of 6 · Three numbers a pixel
Step 1 of 6
Three numbers a pixel
Each pixel on a screen is three tiny lights, red, green and blue, so close together that the eye sees one colour. The computer stores each light’s strength, a level between off and full. A pixel’s colour is a combination of three levels, so with levels per channel there are
colours. The board shows the number of colours, but not the number of levels. Work it out.
Step 2 of 6
Bits per pixel
Look inside is open: each pixel in the magnifier has split into three lights, and each light has risen into a column as tall as its level. A whole pixel takes the bits of all three channels together. In true colour that is bits, three bytes, which is why it is also called “24-bit colour”.
Step 3 of 6
Base 16
A byte written in base 2 is eight digits, long and easy to get wrong. So programmers write bytes in base 16, hexadecimal. It has sixteen digits: to , then A, B, C, D, E and F for to . The place values are , , and so on.
The trick is that : each hexadecimal digit is exactly four bits, so a byte is exactly two digits. becomes , and becomes , four bits per digit.
Step 4 of 6
Colour codes
Web pages and drawing programs write a colour as three bytes in base 16, after a # sign, always in the order red, green, blue: #RRGGBB, where RR are the two digits of red, GG of green and BB of blue.
#FFFFFF is white, #000000 is black, and #FF0000 full red.
Step 5 of 6
Reading a code
To read a pair of digits, multiply the left one by and add the right one. Try it on the colour code of sea green, #3CB371.
Step 6 of 6
Light that adds up
The columns in the magnifier are light, not paint. When the screen lights several of them together the eye receives them all, and the light adds up: the more you light, the brighter the colour. Three full lights look white. What do you see when only two of them are on?
Loading the interactive version…
Loading the interactive version…
Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.
Practice · Calculate
The board shows that at this depth a pixel can show 4096 colours. How many levels can each channel, red, green or blue, take?
Practice · Calculate
The board shows that at this depth a pixel can show 4096 colours. How many levels can each channel, red, green or blue, take?
Practice · Reach the target
Change Bits per channel so that a whole pixel, all three of its channels, takes exactly 12 bits, a byte and a half, and press Check.
Practice · Reach the target
Change Bits per channel so that a whole pixel, all three of its channels, takes exactly 12 bits, a byte and a half, and press Check.
Practice · Calculate
In base 16 the digits are 0 to 9 and then A to F, which are to . What is in base ten?
Practice · Calculate
In base 16 the digits are 0 to 9 and then A to F, which are to . What is in base ten?
Practice · Choose
Which colour is #FF8000?
Practice · Choose
Which colour is #FF8000?
Practice · Calculate
In the colour code #3CB371 the two green digits are B3. How strong is the green, in base ten?
Practice · Calculate
In the colour code #3CB371 the two green digits are B3. How strong is the green, in base ten?
Practice · Choose
A pixel stores red 255, green 255 and blue 0. Which colour do you see on the screen?
Practice · Choose
A pixel stores red 255, green 255 and blue 0. Which colour do you see on the screen?
Lesson complete. Every practice question here is done.