Web Development with HTML and CSS

Color Codes

Assessment
Activity
Enlightenment
Hexadecimal number system has how many digits?
2
8
10
16
On a digital device, white results from
the absence of red, green, and blue
the absence of cyan, magenta, yellow, and black
the highest intensities of red, green, and blue
the highest intensities of cyan, magenta, yellow, and black
An RGB color is defined by the amount of
red, gray, and blue
red, gray, and black
red, green, and blue
red, green, and black
The fourth value used with the rgba method represents
aqua
alpha
area
average
Which hex value represents a shade of green?
00AA00
0000AA
AA00AA
AAAA00

The Mystery of 256

I bet you are wondering why the intensity values for RGB range from 0 to 255. Why not 0 to 99, or 0 to 999? What is so special about 256 anyway?

To uncover the mystery of 256, read the information below and answer the questions.

A bit is simply a binary digit that has only two possible values; a zero (off) or 1 (on). Ultimately, a computer is a binary machine and sees everything as zeros and ones.

A byte is the smallest addressable unit of memory for storing digital information and for the vast majority of computers consists of eight bits.

Consider this.

  • 1 bit can store one of 2 possible values: 0, 1
  • 2 bits can store one of 4 possible values: 00, 01, 10, 11
  • 3 bits can store one of 8 possible values: 000, 001, 010, 011, 100, 101, 110, 111
  • 4 bits can store one of 16 possible values
  • 5 bits can store one of 32 possible values

There is a pattern to this!

# bits (b) 2b # possible values
1 21 2
2 22 4
3 23 8
4 24 16
5 25 32

1. How many possible values can be represented through one byte (8 bits) of memory?

# bits (b) 2b # possible values
8

2. How many bytes of memory are needed to store an RGB color value.

Remember a single RGB color includes intensity values for red, blue, and green.


3. How many different colors may be represented by a single RGB color value.

Recall from the video that this should be over 16 million!




Back to solving the Mystery of 256.

Using fewer than 8 bits per byte would have allowed for fewer possible values, but would have taken up less space (memory). For RGB color data this would have meant fewer colors (and less memory required).

Using more than 8 bits per byte would have allowed for more possible values, but would have taken up more space (memory). For RGB color data this would have meant more colors (and more memory required).

The goal would be to use the fewest amount of bits needed to sufficiently store data comprised of a given set of values. For instance, if I needed to be able to store data that could have 20 different values, then I would use 5 bits (capacity of 32 values) because 4 bits would not be sufficient (capacity of 16 values) and 6 bits would be overkill (capacity of 64 values).

Computer monitors originally were not in color and displayed visual elements by simply turning pixels on (light) or off (no light). So the size of a byte was not determined for the purpose of color but instead for some other values that computers stored.

So, if not color intensity values, what did computers need to store that required 8 bits of memory? The answer to this mystery is a character set (symbols such as those in an alphabet) used to communicate meaning. The character set used (which included the English alphabet) consisted of more than 128 symbols (achievable with 7 bits) but less than 512 (achievable with 9 bits).

Of course, even counting each letter of the 26 letter English alphabet twice (for uppercase and lowercase characters) would have only required 52 symbols. So...

4. What are some symbols other than the upper and lower case letters of the English alphabet that would have justified using 8 bits of memory per symbol?



nothing extra for this lesson :(