when we interact with computers were mainly looking at the screens tens and thousands of tiny little pixels that can light up in certain colors and change to create the images we see and interact with so with a computer that can only think in numbers how does the computer decide which pixel is supposed to be what color and at what time well if you want to know then you're in the right place the colors that make up each individual pixel in your monitor are created with various compositions of the RGB color scheme a certain amount of red green and blue with different amounts of each can create any color with any shade of any saturation darkness or lightness whenever you see the term RGB this is what it's referring to colors based off of combinations of red green and blue before we get to the numbers and software part of this let's briefly talk about the physical component of how pixels work there are actually quite a few different ways this is accomplished and various methods have been used over the past few decades I'm going to skip over CRT monitors because they're vastly outdated and function in a very different way than the other two type of monitors I want to talk about nevertheless these monitors are very interesting so I encourage you to look into how they work there's really brilliant technology in these monitors let's start with LCD or liquid crystal display monitors at the very back of these monitors is a white fluorescent light covered by a few thin layers of a unique substance known as liquid crystalline on each side of this layer of liquid crystalline is a layer of polarizing filament one negatively charged and the other positively charged now because white light is the presence of all colors the layers in front of this white light filter out the colors needed for each pixel each pixel on these filter screens has its frequency charged by electrical signals coming from the top and sides causing it to let through a different color at a different time now the second common type of monitor these days is the LED monitor or light emitting diode this works similarly to the LCD display but instead of a single white fluorescent light at the back it has a layer of LED pixels inside each pixel are three small LED lights one dedicated to each color of the g/b spectrum of course with various wavelengths being applied to each the final color of the pixel is determined through a combination of the three while it may seem to be a problem that the lights inside each pixel might not be equally spaced - depending on which colors are adjacent to others when we zoom out and look at thousands of pixels on the screen our eyes naturally blur them together as needed so now that we've established the physical side of this let's move on to the numbers each red green and blue value has 255 different shades it can be on a scale of black - the color in question there are millions of different ways to combine each of these three numbers and as a result millions of possible colors we can represent but while it's represented this way here your computer isn't using three values of 255 to do this instead it's using one single number that it reads in a very specific way to figure out how a computer turns a number into a color we need to first look briefly at what hexadecimal is I spoken in recent videos about binary in base 10 base 10 is the counting system we've all used we have the numbers 0 through 9 and once we get to 9 we add a digit to the left and flip the previous digit back to zero and start over whenever all of the digits to the right are full we add another digit to the left hexadecimal works the same way but instead of having 10 values for each digit as in decimal or 2 as in binary it has 16 symbols for each digit this means that each digit to the left we add is an increasing power of 16 rather than one of 10 in our normal system called decimal or base 10 this is the number of ones we have this is the number of tens we have this is the number of hundreds the number of thousands ten thousands and so on in hexadecimal this first column is the number of ones we have the second is the number of 16s this is the number of 256 is the number of 4096 'iz and so on because we only have the digits 0 through 9 hexadecimal represents the numbers 10 through 50 by using uppercase letters so counting up past nine and hexadecimal would sound like seven eight nine a b c d e f and then we add one to the left column and start again from zero hexadecimal is very common in computers because it relates well to binary more on that later but for now let's talk about how does this turn into colors each pixel has these three colors each represented by a number between 0 and 255 and as luck would have it two digits of hexadecimal can also represent any number between 0 and 255 so each pixel on your screen has six digits of hexadecimal dedicated to it with six digits of hexadecimal we can represent any number from 0 to 16777215 each individual value of this number is interpreted by your monitor as a different color so each pixel reads that hexadecimal number and can become any number between those now going back to RGB every two digits of this six digit hexadecimal number are dedicated to one of the RGB colors the first two digits are used to determine the amount of blue the second two are used to determine the amount of green and the final two are used to determine the amount of red notice that as I increase the various values their hexadecimal values scale very neatly within the rows of two while the equivalent decimal value sort of jumps all over the place as human beings we really like base 10 numbers likely because we have 10 fingers so why does this method of determining colors use something as strange as base 16 the reason for this is that computers actually have a fairly difficult time working with base 10 I talked in my video on binary which can be found in the description that everything computers do essentially comes down to numbers that use base 2 now 16 is a power of 2 while 10 is not so computers don't have much trouble converting numbers from base to intubate 16 but have to go a bit out of their comfort zone to represent things in base 10 they can still do it incredibly fast as you can see here but when they have to calculate tens of thousands of pixels dozens of times a second and several other values it's far more efficient for them to do it their way which is with powers of two so that concludes the basics of how computers determine what colors to display on the screen as always I encourage you to dive into the massive amount of information available on this topic especially when it comes to the cathode ray tube monitors which again I love and are such brilliant pieces of technology