A color is composed by an amount of red, green and blue.
In computer science, a way to represent a color is to compose between these three amount of colors.
Each amount of color have a presence from
0 (the color is absent) to
255 (full presence of color).
But, because some developers love hexadecimal, they decided to use numbers between
0 in decimal and
255 in decimal.
For color composition, the first pair of digits are used for the red, the second pair for the green and last pair for the blue.
The hexadecimal representation of the colors looks like:
But, for the exercice we decided to represent colors with only 3 digits, so the alias will be:
Part 1: nearest color
The idea is to use a set of colors (
00F) and guess the nearest color from the set.
Example: the nearest color of
Part 2: equality
The idea is to list all the colors in equality cases, because, sometimes, more than one color is the nearest color.
Example: because yellow
FF0 is composed by red
F00 and green
0F0, the nearest colors are both of them.
- Do the same with 6 digit hexadecimal colors
- Find the farthest color
- Compare with color keywords