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

HTML How to Make a Website Customizing Colors and Fonts Use Classes in CSS

is there an easy way to learn hexadecimal color conversion? let's say i want green? how to i convert it to hexadecimal?

is there an easy way to learn hexadecimal color conversion? let's say i want green? how to i convert it to hexadecimal?

4 Answers

If you want green, you can so this: #00ff00.

The first two numbers represent how much red is in the color. Remember: In the 10th base (the one you and I use), we use numbers 0 through 9 (0123456789). But, in the hexadecimal base, you use numbers 0 through f (01234566789abcdef). As you see, a is worth one number more than 9, the same as 8 is worth one number more than 9.

The second two numbers represents how much green you want to use, and the last two digits represent how much blue.

Remember, this isn't painting, it is colors mixing on a screen, so green and blue for some reason mix up to be yellow! I know its weird :expressionless:

In my color value green, I use no red, full green, and no blue.

You can also use an online color picker. :smile:

I hope this helps :grin:

Happy coding! :tada:

:dizzy: ~Alex :dizzy:


ADDED EXTENSION:

Sometimes, CSS also provides values such as green so you don't need to use hexadecimal values :laughing:

Example:

h1 {
  color: green;
  background-color: orange;
}

Thank you for this info. So it is just ok for us noobs not to spend so much time learning how to convert color to hexadecimal numbers? We can just use the color picker and grab the codes for the colors that we want from there?

You don't really have to learn hexidecimal. I simply use a color picker or use one of CSS's built-in colors like green. There are actually hundreds of these color-names, such as maroon. You can surf the Internet to find more about CSS's color-values.

yes your answer is the best answer.

Thank you Alex!

No problem! Can you please provide a best answer? Thank you! :grin:

it's confusing to figure it out..i think i will use the color code chart you provided.

Thank you again

your answer is the best answer.

Thank you again Alex!