RGB values from 0 to 255

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

RGB values from 0 to 255

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What does a red value of 0 mean in an RGB colour?
A None of the red light is used (red is off)
B Red is at full strength
2. What does a green value of 255 mean in an RGB colour?
A Green is switched off
B Green is at full strength
3. Which RGB value is NOT allowed for one colour channel?
A rgb(255, 0, 0)
B rgb(300, 0, 0)
4. What is the range of each number in an RGB colour?
A 0 to 255
B 1 to 256
5. Why does each RGB number stop at 255?
A Each colour uses one byte (8 bits), which holds 256 values from 0 to 255
B Computer screens cannot show anything brighter than 255 pixels

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1rgb(0, 0, 0) AThe first number is one too high. The range is 0 to 255, so 256 is not allowed
2rgb(255, 0, 0) BAll three colours are off (0), so the pixel is black
3Each RGB number can be any whole number from 0 (off) up to 255 (fully on) Crgb(0, 128, 255)
4255 is the top value because each colour is stored in one byte (8 bits), which holds 256 values from 0 to 255 D11111111 = 255
5rgb(300, 0, 0) ERed is fully on (255) while green and blue are off, so the pixel is pure red
6rgb(256, 255, 255) F300 is too big. RGB values can only go up to 255, so the red value must be 255 or less

Definitions

rgb(0-255)

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
rgb(___, 0, 0)
2.
rgb(_, 0, 0)
3.
background: rgb(0, ___, 0);
4.
rgb(255, 255, ___)
5.
top = 2^8 - _

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A # RGB values are 0 to 255
B red = 255
C green = 128
D blue = 256
Question 2
A # Black: all three are off
B red = 0
C green = 255
D blue = 0
Question 3
A p {
B color: rgb(255, 0, 0);
C background: rgb(0, 0, -50);
D }
Question 4
A let max = 255;
B let min = -1;
C console.log(min, max);
Question 5
A bits = 4
B values = 2 ** bits
C print(values) # 256
D maxRGB = values - 1

Answer Key

RGB values from 0 to 255
Section A: Quick Questions
Q1
A — None of the red light is used (red is off)
Q2
B — Green is at full strength
Q3
B — rgb(300, 0, 0)
Q4
A — 0 to 255
Q5
A — Each colour uses one byte (8 bits), which holds 256 values from 0 to 255
Section B: Match the Pairs
Q1
rgb(0, 0, 0) → All three colours are off (0), so the pixel is black
Q2
rgb(255, 0, 0) → Red is fully on (255) while green and blue are off, so the pixel is pure red
Q3
Each RGB number can be any whole number from 0 (off) up to 255 (fully on) → rgb(0, 128, 255)
Q4
255 is the top value because each colour is stored in one byte (8 bits), which holds 256 values from 0 to 255 → 11111111 = 255
Q5
rgb(300, 0, 0) → 300 is too big. RGB values can only go up to 255, so the red value must be 255 or less
Q6
rgb(256, 255, 255) → The first number is one too high. The range is 0 to 255, so 256 is not allowed
Section C: Definitions
Q1
rgb(0-255) — Each RGB number runs from 0 (none of that colour) to 255 (full strength). It fits in one byte, which holds 256 values.
Section D: Fill in the Blanks
Q1
rgb(255, 0, 0)
Q2
rgb(0, 0, 0)
Q3
background: rgb(0, 255, 0);
Q4
rgb(255, 255, 255)
Q5
top = 2^8 - 1
Section E: Spot the Error
Q1
D — An RGB value can only go from 0 to 255 because it is stored in one byte. 256 is too big, so blue must be a number from 0 to 255, such as 200.
Q2
C — Black means every colour is switched off. Green should be 0 (none of that colour), not 255, which is fully on.
Q3
C — RGB numbers cannot be negative. The lowest value is 0, which means none of that colour. It should be rgb(0, 0, 50).
Q4
B — The lowest RGB value is 0, which means none of that colour. It can't be -1, so it should be let min = 0;
Q5
A — Each RGB number is stored in one byte, which is 8 bits. With 8 bits there are 256 values (0 to 255), so it should be bits = 8.