lnf.cymru stimulus sheet · Computer Science · Year 9
The theatre, the people and the colours on this sheet are invented. Hexadecimal colour codes and the number methods are real and are used on every website.
Theatr y Glannau is a small theatre on the coast near Aberaeron. Its website uses four brand colours, written as hexadecimal colour codes such as #FF8800. The theatre’s new LED stage lights can glow in any colour, but the lighting desk only accepts denary numbers from 0 to 255 for red, green and blue.
Rhys, the lighting technician, writes: “I want the stage to glow in exactly the website colours. I also need to turn two of my lighting scenes into hex codes for the website. Can you do the conversions for me?”
A colour code has 6 hex digits in 3 pairs: RR GG BB. Each pair is the amount of red, green or blue, from 00 (none) to FF (full). Each pair is one byte, so it can store 256 different values, 0 to 255.
| System | Base | Column values, right to left |
|---|---|---|
| Denary | 10 | 1, 10, 100, 1,000 (powers of 10) |
| Binary | 2 | 1, 2, 4, 8, 16, 32, 64, 128 (powers of 2) |
| Hexadecimal | 16 | 1, 16, 256 (powers of 16) |
Hex needs 16 digits, so after 9 it uses letters.
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Denary | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Check any answer by converting it back the other way.
| Colour name | Hex code | What it is used for |
|---|---|---|
| Harbour orange (worked example) | #FF8800 | Buttons. Red 255, green 136, blue 0. |
| Sea-grass green | #1E5A3C | The logo |
| Sand gold | #F2C14E | Headings |
| Lifeboat red | #D7263D | “Sold out” labels |
| Scene | Red | Green | Blue |
|---|---|---|---|
| Sunset | 200 | 45 | 99 |
| Moonlight | 128 | 128 | 255 |