Short hex codes are not being accepted in "Use Hex Code to Mix Colors" exercise

Short hex codes are not being accepted in "Use Hex Code to Mix Colors" exercise
0

#1

The code works and is correct as far as I can see. The checks show that the colour being applied is correct but the requirements of changing the words red and green into their respective hex codes are still marked wrong.

The previous exercise had no problem accepting short hex code for black.

And obviously I’m not letting this halt my progress. Thank you for reading, and if you have contributed then to making this the best place to learn modern web dev.

Running on chrome v.64, linux mint.

Source Code:

<style>
  .red-text {
    color: #F00;
  }
  .green-text {
    color: #0F0;
  }
  .dodger-blue-text {
    color: #2998E4;
  }
  .orange-text {
    color: #FFA500;
  }
</style>

<h1 class="red-text">I am red!</h1>

<h1 class="green-text">I am green!</h1>

<h1 class="dodger-blue-text">I am dodger blue!</h1>

<h1 class="orange-text">I am orange!</h1>

Missing Objectives

Use the hex code for the color red instead of the word red

Use the hex code for the color green instead of the word green


#2

You should use the long form hex codes listed in the instructions.


#3

I hate to be pedantic but it specifically says, “Replace the color words in our style element with their correct hex codes” not to use the ones in the table. They evaluate to exactly the same value.
So worst case is slight ambiguity in the question.
*correction


#4

You can create a GitHub Issue recommending an improvement to the wording of the challenge description.


#5

Cool. I haven’t looked at the repo yet and should head over. Thanks for responding.


#6

Since the challenge starts off with “To review, hex codes use 6 hexadecimal digits to represent colors, two each for red ®, green (G), and blue (B) components.”, I believe it is clear the challenge expects the camper to use 6 digit hex codes and not abbreviated ones. Plus, the challenge gives a table with the correct 6 digit hex codes for each color.

If the camper is following this section in order, he/she would not even know about abbreviated hex codes until the following challenge which covers abbreviated hex codes.


#7

Thank you for replying.

I agree, it is clear what the challenge expects, was only expressing my belief that in an exercise what is wanted should be explicitly stated, not implied.

Like many, I have come across various colour coding systems before from things like photo/video editing.

The fact that the exercise previous to the one in question accepted a short code, I saw the pattern extend to pure red and blue and had a flash of genius (so I thought) that was instantly thwarted.
I don’t want you to if you think I’m just a really bad troll. Maybe I was thinking of it as an edge case that I expect to cause trouble later.

Peace oot!


#8

FWIW, I think you’re right that ideally the challenge would accept short hex codes, especially given that:

const a = document.createElement('div');
const b = document.createElement('div');

a.style.backgroundColor = '#f00';
b.style.backgroundColor = '#ff0000';

const aBg = a.style.backgroundColor;
const bBg = b.style.backgroundColor;

`aBg: ${aBg}
bBg: ${bBg}
aBg === bBg: ${aBg === bBg}`

returns

aBg: rgb(255, 0, 0)
bBg: rgb(255, 0, 0)
aBg === bBg: true