FAQ: CSS Color - Color Review

This community-built FAQ covers the “Color Review” exercise from the lesson “CSS Color”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn CSS

FAQs on the exercise Color Review

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

It seems like HSL is a much better option to use than RGB. Are there instances where RGB would be the preferred method? How about Hex?

2 Likes

Well, this is a late reply AND I’m far from being experienced. Hopefully, someone will chime in that has a more experienced answer. From inspecting the open tabs in my browser and a few bookmarked pages, I saw mostly hex being used and then a couple had RGB. I didn’t see any HSL. Is there a certain way that is preferred? I know all are acceptable. Is it just a personal preference?

Mostly yes.

I don’t like to use hex, it’s not readable and you are not able to specify alpha (opacity). So it’s a lot better to use rgb which can be easily transformed into rgba if you want to add opacity. Hex makes sense when you are working on a really old legacy project that has to support IE6 (for example).

Most of the time I use hsl and hsla. Simply because it is readable. It’s easy to make colour lighter/darker, more/less intense, or even change the hue (if you remember how the colour wheel looks) without needing to use a colour palette, you simply change one of the values (h - hue, s - saturation, l - lightness, a - alpha) and the result of this change is easily predictable.


Above applies to web development. In the data science / machine learning projects it’s common to use different colour spaces. In one of my last projects, I decided to convert all the images that were used as a training data to a Lab colour space because it approximates human vision and that was crucial for the model I was building.

5 Likes

Thanks for the quick response! I see how different projects would require you to come at it from different ways. Understanding how they all work is the important part I suppose so that one could apply what is best suited for the project. HSL does seem the easiest to work with or the easiest to wrap my mind around for sure.

1 Like

is there any extension to find what color’s cod(hex or rgb or hsl) is that?

1 Like

Just wanted to make note of what I’m perceiving to be an error in the lesson here. It states:

“You can add opacity to color in RGB and HSL by adding a fourth value, a , which is represented as a percentage.”

But earlier, we were told that alpha is represented as a decimal number from zero to one.

It can be either. They are both treated as a percentage. 0.1 => 10%. The decimal does not need a unit but the percentage does.

4 Likes

Thank you for the quick answer!

1 Like

There are many color pickers that tell you what the HEX, RGB and HSL of the color is. I use ColorZilla

It’s worthwhile to note that RGB and HEX are directly related in that every HEX color has a corresponding rgb() color. Neither have a direct relation with HSL as it is only 22 bit color, not 24. That means there are approximately 5 or 6 possible RGB/HEX values corresponding with each HSL value. We could say that HSL has less saturation (in a very small sense) than the others. The more saturated a color is, the tighter the bandwidth around the central hue.

#FF0000            =>  satuarted

hsl(0, 100, 100)   =>  less saturated
4 Likes