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

Brady Cramer
Brady Cramer
659 Points

This has to do with Hexadecimal Math in Color Coding

I understand hexadecimal system as far as base knowledge goes (i think). The main thing I'm concerned about and hoping to learn from you guys is the math when applying to colors. for example #6a7b8c , what I'm mainly confused about is what does 6a represent exactly, is it a percentage? do you multiply ax6, or add a+6, and is that a percentage of how much of that color should be applied?

everything prior in my lesson i understand and the teacher said it isn't to important for me to understand it, just know how to use it, but I'm set to figure it out.

1 Answer

Gavin Ralston
Gavin Ralston
28,770 Points

The hex values represent 0 (00) to 255 (FF)

So they're just the 256 value ranges for RGB in hex format

Brady Cramer
Brady Cramer
659 Points

so if the amount of green in 6a and a=10 and 6=6 and you multiply 10x6 and get 60. is that kind of like 60% of 256% green?

Gavin Ralston
Gavin Ralston
28,770 Points

No, the 6 represents 96, and the a represents 10, so 6a represents 106 decimal, which is slightly under 50% of full value.

Each pair in a hex value represents one number, unless you're using the shorthand #xxx notation, in which case #fff still really represents #ffffff, it just uses the same hex value for both places.