Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.