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

In the rgb function, the value rgb( , , ) represents 100% white, while the value rgb( , , ) represents 100% black.

please help to answer this quiz question on color values

thanks Damien,it worked

5 Answers

Damien Watson
Damien Watson
27,419 Points

The 'rgb(red, green, blue)' function accepts 3 numbers, one for each colour. The colours range from '0' (none) to '255' (full). This means if all are set to '0', then there is no colour (black), where all '255' is white.

 .black   { color:rgb(0,0,0); }
 .white   { color:rgb(255,255,255); }
/*
  Other colours can be achieved by combinations as you
  would mix light ... eg
*/
.red        { color:rgb(255,0,0); }
.green    { color:rgb(0,255,0); }
.blue      { color:rgb(0,0,255); }

.orange { color:rgb(255,164,0); }

/* etc. */
Damien Watson
Damien Watson
27,419 Points

I know this was a year ago, but... the challenge is looking for '0,0,0' because it is expecting an integer value. Like typing '000' into a calculator, you will get '0' not '000'.

In CSS '000, 000, 000' does actually work but why type 9 characters when you can use 3?

Thats what i typed i got the answer wrong

In the rgb function, the value rgb( ,
,
) represents 100% white, while the value rgb( ,
,
) represents 100% black.

I don't get that, pls can some help me with it.

Damien Watson
Damien Watson
27,419 Points

Hey Ted,

I believe the person asking the question didn't know what numbers to put in for white and black, which I answered above.

I'll break it down for you a bit more if that helps. The rgb function accepts 3 numbers which range from '0' to '255'. Think of this number as a slider in photoshop or the like, where '0' is at the left (no colour) and the '255' is at the right (full colour).

The numbers represent red, green and blue, so this colour would be orange: rgb(255,127,0);

red = 255 (full red) green = 127 (half green) blue = 0 ( no blue)

As mixing colours in light is cumulative, the more of each colour, the closer to white you get. The less of each colour takes you closer to black.

Hope this helps clear it up for yourself and future students. Cheers, :D

fill in the correct answer in each blank provided below.

In the rgb function, the value rgb( 252, 255, 255) represents 100% white, while the value rgb( 0, 0, 0) represents 100% black.