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 trialTom Nguyen
2,979 Pointsis 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
Alexander Davison
65,469 PointsIf 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
In my color value green, I use no red, full green, and no blue.
You can also use an online color picker.
I hope this helps
Happy coding!
~Alex
ADDED EXTENSION:
Sometimes, CSS also provides values such as green
so you don't need to use hexadecimal values
Example:
h1 {
color: green;
background-color: orange;
}
Tom Nguyen
2,979 Pointsyes your answer is the best answer.
Thank you Alex!
Alexander Davison
65,469 PointsNo problem! Can you please provide a best answer? Thank you!
Tom Nguyen
2,979 Pointsit's confusing to figure it out..i think i will use the color code chart you provided.
Thank you again
Tom Nguyen
2,979 Pointsyour answer is the best answer.
Thank you again Alex!
web pad
4,483 Pointsweb pad
4,483 PointsThank 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?
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsYou 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 asmaroon
. You can surf the Internet to find more about CSS's color-values.