It would be nice to be able to display the actual hexadecimal value as well as the RGB value of the background color. To do that we need to add another parargraph <p>
in the HTML code, insert a <span>
, and give the span an id "colorcodes"
.
Then we need to update the JavaScript so that the color codes are updated in the span
with id "colorcodes"
. First we need to combine our time values to a new string, that is the strings in rgbHour, rgbMinute, and rgbSecond, separated with a comma.
We already have the hexadecimal value in the variable hex
, so we do not need to work with that. Instead we write a code to update the content of the span element with id "colorcodes".
Now the color clock also displays the background color in text on the screen.
In step 7a we will add some HTML elements and then in step 7b some JavaScript to emphasis the clock values differently so we can choose between different interpretations, or shades, for the background color.