Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Foundations Advanced Selectors Additional Pseudo-Classes

#hexadecimal color(s)

I don't understand how the instructors know what colors they're choosing when using hexadecimals. I know what RGB means when referring to the 3 primary color elements and also, I understand that every pair of digits in the hexadecimal represents the value of each primary color but, I'm puzzled how to conclude the ending result. I've read that in theory the number scale starts (0-9) then (A-F) represents (10-16). If somebody can explain I would be much obliged thank you!

2 Answers

Andrew Shook
Andrew Shook
31,709 Points

Chances are they don't know the actual Hex values off the top of their heads. When I get mockups I usually write down all the color values I get from Illustrator or Photoshop at the top of the css file. If I am sent something that has just the RGB values I use this to convert the values to Hex. You can use RGB but I prefer Hex values since they are faster to type.

As far as how RGB is converted to hex, I'll show you an example. So we will convert rgb(81,165, 23) to hex. First you take one of the RGB values and divid it by 16. So 80 / 16 = 5.0625. So the 5 becomes the first number of you two hex numbers for red. Next you take the decimal and multiply it by 16, and that will give you the second digit. In this case that would be 1.

Jonathan Martinez
seal-mask
.a{fill-rule:evenodd;}techdegree
Jonathan Martinez
Full Stack JavaScript Techdegree Student 6,439 Points

This may not be the answer you were looking for, but I remember Nick Pettit saying that eventually when you use certain colors you memorize their value, which would explain how instructors know what color they are picking. I was also confused on this and decided to just google hexidecimal colors. There I was able to find a palette of colors with values. Hope this helps.