02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Understanding RGB

From the very early days of the web colors where defined with RGB values - Red, Green, Blue. The mix of these three base colors is what creates the millions of colors available on most modern devices. Each color channel has 255 color value options combined into a total of 16,581,375 color combination possibilities. In this lecture we will meet the common ways to describe color in on digital devices using these color profile options. By the way, You might of heard of 16Bit displays or 32Bit - these differences don't really mean much when it comes to digital colors as most modern interfaces only are capable of showing a variety of 16 million colors - monitors with 4 color profiles instead of 3 create a vastly larger color options - but the web doesn't really support more color profiles currently. In the olden days of the web when monitors where less robust then they are today there was a term called "Web Safe" that was a subset of 255 colors in total. Now days, with most digital display system supporting millions of colors this term is obsolete. By the end of this lecture, you will know how to create color profiles in RGB.

KeyNotes:

  • Moving form 256 colors to over 16 million of them.
  • the RGB Structure : #RRGGBB
  • Can you step out of the web safe colors?

properties: css3, color, rgb.

Video Transcript

00:01(simple electronic music)
00:05- In the last lecture we were introduced for the first time
00:09with named colors and really with colors in general
00:12It's time for us to take a step deeper,
00:14and we're gonna take a look at RGB colors.
00:17And RGB stands for red, green, and blue.
00:20By the end of this lesson not only will you
00:23know how to define 256 colors as we've done
00:25in the last lecture, you'll actually have power
00:28over controlling over 16 million colors.
00:32We're gonna learn how do we create
00:34those 16 million color combinations.
00:36So by the end of this course,
00:38you'll know basically how to do that,
00:41you'll know how to structure RGB colors,
00:43you'll understand how they work,
00:44and moreover than that,
00:45you're gonna know the answer to the question,
00:47"Can you step out of the web safe colors?"
00:49Should you stick to those 256 colors
00:52or could we go on to the millions
00:54and find all the different various color combinations?
00:56Now you might have your own answer
00:58if you're coming as a designer,
01:00and we would love to hear your
01:01contribution to that question.
01:03So go ahead in the comments below, let me know.
01:05What do you think?
01:06Could we step out of those web safe colors?
01:08In what conditions could we?
01:09And what conditions can't we?
01:11So try to think about that question
01:12as your watching this lecture,
01:14and I'd love to hear that debate about it
01:16in the comments below.
01:19In the last lecture we left off talking about how
01:22there's a lot of different names to colors.
01:24But I tell you that in general,
01:26I prefer not working with the names
01:28but actually working with definitive color values.
01:31And that's exactly the topic of this lecture.
01:34We're gonna start looking at and finish looking at
01:36and understand how to define colors.
01:38And you can see these hex values,
01:40which is exactly what we're gonna be talking about
01:42and their decimal values.
01:45Now, I want to start off and just click right into
01:48the Understanding RGB and RGBA.
01:51And I want you to basically take a look at this
01:53diagram I created right here below.
01:56It's actually a JavaScript code here
01:58to help us understand the concepts.
02:00So to be able to start, just make sure that you
02:02just drag all three items to the end
02:05until everything turns black.
02:07Our background is black,
02:08our sliders and all the three elements are black.
02:12Now, the color system that you are probably familiar with
02:15goes from one all the way to nine,
02:17well, zero all the way to nine.
02:20And once the digit nine arrives,
02:21then we move on to the next element,
02:23bumping it up by one,
02:25and going back to zero to create 10.
02:27That's the most common numbering system.
02:29But on a computer and in general in mathematics
02:33who said that there could only be ten values?
02:36A very common numbering system in programming
02:39is called Boolean Values, which basically
02:42enables you to just have a value of zero or one.
02:46So for example, if I have here the value one,
02:49that would equal one, right?
02:51But if I had here the zero, the value ten,
02:53that would be the following number after zero, one, ten.
02:57So, zero, one, ten, ten would equal three.
03:00Now you don't have to worry too much about
03:02how these systems work, but you do need to understand,
03:05before you even understand color theory,
03:08of how do we represent colors
03:10on a monitor using RGBA values,
03:14which stands for red, green, blue.
03:18RGB, it's not RGA.
03:19I'll fix that later on.
03:21So, RGB, basically we have here
03:23the red channel is represented by two digits,
03:26the next two digits represents green,
03:30and the next two represent blue.
03:32Now, if there are only two digits,
03:35and we're using the Ten system,
03:37then the maximum values that could be here,
03:39the maximum combinations of values would be 100,
03:41from zero all the way to 99.
03:44To enable us to add more values
03:46in a certain set amount of place,
03:48in our case want to have 255 colors
03:52in total represented in this area.
03:54To enable that, we're gonna use a numbering system
03:58that doesn't start from zero and ends at nine,
04:01but it's starts from zero, reaches nine.
04:03So let me just show you that.
04:04We have your zero, one, two, three, four,
04:06five, six, seven, eight, nine, all that is familiar.
04:08Once you move on to the ten digit,
04:11instead of ten, it's represented by a,
04:13and then b, and then c, and then d,
04:15and then e, and then f.
04:17So in total there are 16 different digits available
04:21for this area from zero all the way to 16.
04:23Now if I wanted to represent the value 16,
04:26I would literally have to push one aside,
04:29creating the value 16 with the one, zero.
04:33And then again, the cycle would go through,
04:35where I would get to 1f, which would count for 31,
04:39as you could see here,
04:40moving to 20 which actually equals 32.
04:44So if I'm representing 20 in this numbering system,
04:48where we go from nine, it turns to b, c, d, e, f,
04:52and then it turns to 30.
04:53Now, it's really important for you to understand this
04:55so make sure if you don't get it,
04:57stop the video for a second,
04:58go into this illustration, capture this scroller,
05:02play around with the values.
05:05Now, the values could literally go ahead
05:07all the way from 00 all the way to ff.
05:11And all these together represent the F channel.
05:14So, I could represent the blue channel, really.
05:18So, I could have here is no blue at all,
05:21or no color being displayed,
05:23all the way to the brightest blue possible.
05:25Or I could have here a lighter shade of blue,
05:28which is a mix of blue and nothingness
05:30or darkness in our case,
05:31but this darkness is really just created
05:33because a lack of color coming from the other areas as well.
05:37So if I would have here a light color, a light blue
05:40and I would go ahead and notch up
05:42all the colors on the other sides,
05:44we'll see that we would create a color combination
05:46that would create this yellow.
05:48But it would really be constructed out of
05:51absolutely red, absolutely green,
05:53and a little bit of dark blue.
05:55And if I put up all the colors together,
05:58where I'm adding O to the red,
05:590 to the green and 0 to the blue,
06:01I would get white.
06:02If I don't set no color at all, then I would get red.
06:06And different color combinations,
06:08and there's so many color combinations
06:10that you could create using these three,
06:13basically these six digits because each two digits
06:16represents 255 different varieties of channels.
06:21So if I go ahead here and I just here a
06:23small little calculator, let me just find it.
06:26And if I take a calculator and I said,
06:27"Okay so if I have 255, and I duplicate it by 255,
06:31duplicated by 255, then the color combinations possible
06:35is over 16 million colors.
06:37And literally, just with these 16 digits,
06:40I don't have to write a number that is insane,
06:43such as six million,
06:44to be able to represent the color white.
06:46But literally, all I have to do to
06:48represent the color white is write this number.
06:50And this number is 16 million.
06:53This number represents that 16 million
06:55because as you remember,
06:57if the first digit here, if this is 16, right?
07:00Let me just go ahead here, if this is 16
07:02and I duplicate it by the 16 possible values here,
07:06and I duplicate it by the next 16 possible values,
07:09right next to it, and I duplicate it by the next 16,
07:13so, these four digits alone,
07:15the combinations possible between them
07:17would give you already 65 thousand combinations.
07:21If I add just one more digit, and I'll duplicate it by 16,
07:24we're already in a very high number.
07:26We're already in the millions.
07:27And all that's left for me to duplicate it one more time,
07:30and that's really the combination
07:32of all possible values that I could get here.
07:35Now notice also in our demo that I've created here,
07:37I've also added the matching and real numbers here
07:40in case you get confused or forget about it.
07:43So, literally we have here, these are the values that are,
07:47if it's ff, it's 255.
07:49If it's zero, it's zero, obviously.
07:52Now, because it's really important,
07:54because this value really represents
07:58this really insane number,
08:00but we really just want to use them as
08:02the first two digits are for red,
08:04the next two are for green,
08:06and the last two are for blue.
08:07So you always put six digits together inside there.
08:11So I'm gonna go ahead there and show this in action.
08:15Let me just pick a color that's supposedly that I like,
08:18and let me say I want this to be my actual background.
08:20So I like this yellow, I'm happy with it.
08:23I would go ahead and copy that number, or that digit,
08:26go right back there into my editor.
08:28Let me just set that to be my background color.
08:30So I'm gonna go ahead here to my background.
08:32I'm gonna start it with a hashtag.
08:34Anytime I'm using a hexidecimal value,
08:36I will start it with hashtag.
08:38If I go ahead here and click on refresh,
08:40I'm gonna go ahead and also get rid of my RGBA here
08:43and just refresh on the beginning of the page,
08:44we'll see that now the value that I'm getting
08:46is a variety of yellow.
08:49Now, as a side note, you don't have to
08:51memorize these colors, in general.
08:53We're gonna talk about that a little bit more in the future,
08:56but I just wanna kind of have a small little highlight here.
08:59Do understand, very important to understand,
09:01the construct of it, the basics of red, green, blue,
09:04and just remembering that RGB in general,
09:06remembering that combination between those two values
09:09of the red, green, blue,
09:12and how they create together these colors.
09:15Now, if you're working with Firefox,
09:17or a browser that supports Colorzilla,
09:20make sure that you add that plugin.
09:22By adding this plugin,
09:23notice this plugin that I have right here,
09:25if I click on it, I can go any place on my document,
09:29and literally just fetch the color.
09:31Once I fetch the color,
09:32it's going to be copied into my clipboard,
09:34and when it's copied into my clipboard,
09:35I could literally just paste it anywhere
09:37I want to as that color and immediately use it
09:40without needing to memorize any colors.
09:43So that's it about RGB.
09:45We're almost done with this topic
09:46because in the next lecture we're gonna stay in this topic,
09:49we're not moving away from that topic
09:51and we're gonna talk about alpha channels.
09:53So we'll see you in the next lecture,
09:54which won't be too long,
09:56where we're gonna explore alpha channels.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!