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

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

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

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

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

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

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!

1 Like

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