The Amazing Math behind Colors!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi everyone my name is covina and welcome back to another video as you can probably tell from my logo i'm a big fan of colors my favorites are pink purple and magenta but i don't think there's a single color i don't like another one of my passions is math and science i've loved them my whole life and they've been present in most of my videos and when you have multiple passions like this it can be extremely rewarding to find overlap between them and so that's exactly what i did you might be thinking that math and colors are only tangentially related with colors corresponding to different wavelengths of light and that's about it but thankfully there's a lot more than just that i'm talking things like linear transformations of color spaces normalized cone cell responsivity functions luminance and chromaticity diagrams and of course all the math and science that goes into producing colors both on screens and on paper we'll get to all of those in this video but first we need to cover the basics so what even is color well to answer that we have to start with light light comes in the form of particles called photons and due to quantum mechanics each photon is simultaneously a particle and an electromagnetic wave it's common to think of color as a property of these waves but that's only partially true the property in question is actually wavelength which is the distance between each crest of the wave wavelength is detected by our eyes which sends signals to the brain that are interpreted as colors so color isn't an inherent property of light instead it's a psychological phenomenon that relates to wavelength but only indirectly so it's not as simple as each color being a different wavelength because there's the middle step of how our eyes convert light into signals for our brain so what are our eyes actually doing within the retina and especially the fovea there are millions of cells called cones they come in three varieties and each type specializes in detecting certain wavelengths depending on the exact wavelength each type will send a different strength signal to the brain the intensity of the signal is determined by a mathematical function that takes one input wavelength and gives one output responsivity the first type is called the short cones they detect light with wavelength between 400 and 550 nanometers with a peak responsivity at 440. then there are the mineral cones from 400 to 650 with a peak at around 540. finally there are the long cones from 430 to 700 with a peak at 570. the thing that makes these cones so useful is that the responsivity graphs overlap quite a bit if we were to graph all three at once it would look something like this as you can see responsivity for the short cones is a lot lower than that of the middle or long cones but what's usually more useful is normalized responsibility this is when we scale each graph to make them all the same height with this normalized graph we can now take a look at a few examples so a wavelength of 440 will activate the short cones a lot and the middle and long cones only a little bit when the brain gets the signal of the short cones fully active and the other two types barely active it knows to interpret this color as blue something like 540 will activate the middle cones fully the long cones almost as much and the shortcodes not at all and the brain interprets this as green and then 630 activates the long cones halfway the middle comes a tiny bit and the short cones are not at all and this gives us a red and with these three example wavelengths you can see why the long middle and short cones are often called the red green and blue cones respectively but i don't really like these terms with the green color of 540 for example the so-called red cones are activated almost as much as the green cones and with the red color of 630 the long cones aren't even fully activated in reality red green and blue are only fractions of what the cones detect they just happen to be where each graph peaks actually that's not even true the peak wavelength for the long cones is 570 which we see as yellow for all these reasons i would generally advise against calling them the red green and blue cones but i do think it's fine to color code them this way because it's a very useful convention anyway if we choose something like 200 nanometers this doesn't activate any of the cones and so the brain doesn't even know it's there in fact the vast majority of types of light can't be detected by us the wavelength can be too short as is the case with ultraviolet x-rays and gamma rays and it can also be too long like with infrared microwaves and radio waves and if we scale the line to powers of 10 you can see just how small the visible part is but of course it's still extremely important because it's the only type we can see and if we fill in the entire visible spectrum with the colors that we see at each wavelength it looks approximately like this so there's definitely a lot of colors here but there's also a lot missing for example where is cyan it's usually between green and blue but the color we get here is way too dark and for that matter where are my favorites pink purple and magenta usually color wheels loop around and magenta is found between red and blue but this one's just a line that goes from red to bluish purple there's a few more like brown gray and beige but most importantly where are black and white clearly the spectrum doesn't tell the full story so then how do we find the missing colors well some of them are actually pretty easy for example black is the color that you see in the absence of light it's also what we see if there is light but it's outside of the visible spectrum and this is actually why uv is sometimes called black light but to get other dark colors like brown we need to consider not only wavelength but also luminance luminance measures the amount of visible light photons received per area the reason it affects color is that we have about 6 million cones per eye so a single cone can't really do much on its own with high luminous light there's a sufficient amount of photons to activate every cone so the brain sees the color fully but with low luminance light some cones don't get anything at all if none of them got anything the brain would see black but when it gets mixed signals it kind of mixes the two together to get a darker version of the color depending on the exact luminance the color you see can lie anywhere on the gradient from the fully bright color down to black and at this point i want to clarify a debate about black you may have heard some people say that black isn't actually a color because it's what you see when there's no light but this interpretation is so problematic not only are there countless wavelengths like ultraviolet that produce black light but light isn't what makes something a color as we've seen colors are ultimately a psychological phenomenon anyway with red green and blue we see the low luminance versions as variants of the original colors like burgundy dark green or navy blue but orange and yellow are so intense on their own that we consider their darker versions to be a completely new color brown and if you don't believe me that brown is the same as dark orange here's a bit of an experiment you can do set your phone screen to nothing but orange and find a bright orange object that matches it then turn your brightness all the way down to its minimum value as long as there's nothing else on the screen you'll eventually start to see it as brown i can't guarantee that this works for everyone but it's at least worth giving it a try anyway if we want to show all the possible colors that can be achieved this way a line is no longer good enough we need two dimensions one for wavelength and one for luminance and when we fill in the entire rectangle it looks like this so factoring in luminance gave us a few extra colors but we're still missing cyan white gray and most importantly pink purple and magenta so if luminance doesn't help us find those then how do we find them well to do that we need to introduce the idea of a color space so since there are three types of cones it means we have three variables to worry about these are the normalized responsivity values for the long middle and short cones when you have three variables like this what you can do is represent them in 3d space with each axis corresponding to a different variable so the x-axis represents normalized responsivity for the long cones and the y and z axes are the same thing for the middle and short cones respectively with this we can represent any possible combination of responsivities by a 3d vector which basically just means a point in space to help with depth perception the dots are made bigger when they're closer to the camera since each variable ranges from zero to one it means that every possibility lies within this one by one by one q so let's take for example a wavelength of 500 nanometers at this wavelength the normalized responsibility is about 0.3 for the long cones 0.5 for the middle clones and 0.1 for the short cones that gives us the vector 0.3 0.5 0.1 so what we can do is graph this point in our color space and then color it with the color that the wavelength produces and we can repeat this process with more and more wavelengths so here's 480 460 440 520 560 and so on and so forth when doing this it helps to think of normalized responsivity not as three separate functions but as one single function where the input is wavelength and the output is a point in space whose three coordinates each correspond to a different cone type this way we get what's known as a parametric equation where you can basically trace out the path of a point in space as you change the input variable so now we just have to do this in three dimensions with the normalized responsivity functions but wait a minute what even are the equations for responsivity values we know what they look like but how are they defined mathematically well the thing is they're not mathematically defined they're based on scientific data that can't be represented with a simple equation what we can do though is approximate them i've chosen to use the normal curve it's defined by y equals e to the negative one half x squared with a few parameters that can change the shape the normal curve is found all the time in nature so it's often a very good approximation for things and if we get the parameters right we can produce the fallen graphs which as you can see are very good approximations now that we have the equations we just have to graph it and we get a curve like this it starts at the origin with ultraviolet then moves up the z-axis with blue light as it moves down again it begins to move up the y-axis with green light and soon it also moves up the x-axis with yellow orange and red light before returning to the origin with infrared now this might seem kind of pointless because it doesn't give us any new colors it just shows us what we already have but maybe you'll remember that the space of potential cone response combinations was this entire cube and this one-dimensional curve only shows us a portion of it so to find the missing colors we need to look at other locations within the cube the first place that might stick out to you is the top left corner you can see that the red section connects to the green section which itself connects to the blue section but red and blue don't connect to each other instead they both just approach zero but if we had a way to activate both the long and short cones then it would make new colors in this gap and as it turns out this is exactly where we can find magenta purple is also found nearby but a bit closer to blue and then there's this area on the right here since peak responsivity is so close for the long and middle cones it allows wavelengths where both types are activated almost fully but for middle and short they're not closed at all so we don't get as far from the origin in this section but if we could activate both of them some more we would get a color further out and closer to the camera and this is where cyan is found and then finally what if the three types of cones were activated all at once to their maximum extent well this is actually how we make white and a lot of other colors are found in between these points of interest so pink is between magenta and white beige is in between yellow and white turquoise is in between cyan and green and the list goes on and remember you can always lower the luminance to get a darker color in this color space that actually has the effect of moving all points towards the origin which is where black is found this is how we got brown from earlier and is also how we find our last major color gray in between black and white any color you can think of will be somewhere within this color space but there's still an issue we've already looked at each visible wavelength and all that gave us was the parametric curve so it raises the question what kind of light actually produces these colors well so far we've only been looking at monochromatic light which is when every photon in a beam of light has the same wavelength this produces what are known as the spectral colors which are found along the curve that we graphed in real life though light usually consists of many different wavelengths all at once so let's take for example light with a mix of 450 and 630 nanometers in equal proportions when the light reaches the cones half of them get the 450 and half get the 630 which produces mixed signals but what the brain cares about is the average across each type when we find the corresponding location in the color space it's in between purple and magenta and so that's exactly what the brain sees but instead of doing that whole process there's an easier way to find that location you just find the two component wavelengths and take the weighted average so if there was more blue light than red the point would be closer to blue and vice versa but when there's an equal amount of both the point is halfway between them there's an infinite amount of potential combinations and the way we visualize them is with an emission spectrum which can be graphed as a spectral power distribution it's just a function that gives us the amount of light present for each wavelength so for example the emission spectrum of pink light will look something like this you can see it has a lot of long and short wavelengths but not as many of those medium ones in the color space we take the weighted average of these and the point we end up with is right where pink is so that's how we see it and this is how the rest of the colors are formed not from individual wavelengths but from combinations of spectral colors if we fill in the entire volume of color space that can be reached with combinations of spectral colors it forms this kind of cone shape this is called the visible gamut and any color you can think of will be somewhere within it it's also what's known as a convex set which means you can never get a color outside the set by combining ones within it but that presents an issue earlier i said that the space of all potential colors was this one by one by one cube but the visible gamut is still only a fraction of it so what kind of colors do we find outside the visible gamut but still within the cube well these are known as impossible colors because there's no combination of spectral colors that can reach them one example is hypergreen this is what you would hypothetically see if the middle cones were fully activated but none of the other cones were activated this is impossible because any wavelength that activates the middle cones will also activate one of the other types so this three-dimensional color space is cool but it's hard to visualize wouldn't it be nice if we had a way to visualize all the colors in two dimensions the answer is yes of course it would be but it's impossible to do so luckily though there's a trick so if you remember from earlier lowering the luminance of a color has the effect of moving it towards the origin but the cool thing about it is that even when you change luminance there's some intrinsic quality of the color that doesn't change this is called chromaticity and straight lines from the origin can be thought of as lines of consonant chromaticity even though you need three dimensions to show all possible colors you only need two dimensions to pass through all possible chromaticities so our goal is to form a two-dimensional chromaticity diagram there are so many different approaches you could take but the most popular one is called the cie 1931 xy chromaticity diagram but to understand how it's formulated we first need to look at the cie color space a color space is just a way to arrange colors in 3d space so there's an infinite number of ways to do this the one i've been using is called the lms color space which is based on cone response but the most influential color space is the cae 1931 xyz color space it's unique because it actually takes into account the psychology of color perception so remember when i showed responsivity from each cone type the long and middle cones had a lot more responsivity than the short ones and what we did was normalize all three types but this discrepancy actually has a significant effect on how we see colors if we add all three functions together then this gives us a function of total responsivity as you can see total responsivity for green and yellow wavelengths is very high while reds and oranges are a bit lower and then blue is a lot lower that helps explain why we see colors around yellow as a lot brighter than others this is called relative luminance but it's a confusing name because it's unrelated to actual luminance anyway the cie color space basically takes the lms space and transforms it so that the y-axis roughly corresponds to relative luminance the way it does this is with a linear transformation to determine where a point will end up in the new color space you take its coordinates in the old color space multiply them by constants and add them together these constants are usually arranged in a matrix so you can do vector matrix multiplication a special property of linear transformations is that straight lines remain straight even after the transformation another property is that the origin never moves due to these facts our lines of constant chromaticity are still lines of constant chromaticity even in the new color space which makes it just as practical as the lms space but the big advantage of the cie color space is that it makes the curve of spectral colors into a much more manageable shape so the cie color space is basically what everything is based on and that includes the chromaticity diagram now how do we actually construct the diagram well we just need an algorithm that takes colors from the three-dimensional color space and maps them to the two-dimensional chromaticity diagram in such a way that any two colors with the same chromaticity will end up in the same location the cie diagram achieves this with the following method first you take the color and figure out what chromaticity line it's on then you follow that line until it intersects the plane x plus y plus z equals one then take the x and y coordinates of the point where intersect finally take the original color and plot it in the chromaticity diagram at those same x and y coordinates if we perform this process for all of the spectral colors we get the following which is basically the outline of the full diagram my graph is a slightly different shape but i'm guessing that's just because of my approximations for the responsivity functions anyway to get the full diagram we just need to do the same process with one color of each chromaticity but each chromaticity has infinitely many colors and we can only choose one so what we usually do is just use the one with the highest luminance and this finally gives us the full diagram the curved outline represents the spectral colors at varying wavelengths while the straight section is called the line of purples since we use maximum luminance for each chromaticity some of these are actually brighter than the correct spectral colors but it doesn't matter that much because they still have the same chromaticity the cool thing is that this diagram makes it really easy to combine colors so with a mix of 450 and 630 nanometers you can see that the midpoint is great near magenta like we saw before to get white you could combine every spectral color at once or just two from opposite sides like yellow and blue so at this point we know how to combine spectral colors to form other colors but how are these combinations created in real life well there's so much that could be said about the physics behind light but for now i'll make it short so most objects we see don't actually produce their own light instead they absorb photons from the environment and then re-emit them in all different directions this is called diffuse reflection on the atomic scale individual electrons absorb the incoming photons and use this new energy to move to a higher electron shell they can also release photons to move to a lower shell every shell has its own specific energy level meaning every combination has a specific energy difference for an electron to make the transition the photon that it absorbs or emits needs to have an energy equal to the energy difference between the shells so photons can only be reflected if their energy is on the list otherwise they won't get reflected photon energy is actually proportional to frequency of the wave which itself is inversely proportional to wavelength that means that only a few wavelengths from the visible spectrum end up getting reflected the energy levels of electron shells are different for every element which gives each one its own signature set of spectral lines with hydrogen for example we get these four lines in the visible spectrum called the balmer lines corresponding to electron movement to shell two if we find these wavelengths on the chromaticity diagram and take the weighted average we get pink which is exactly why we see a hydrogen discharge tube as pink but you might notice that the lines have non-zero thickness to them that's because the photon's energy doesn't have to be exact in fact based on a variety of factors including density the lines can broaden beyond the point of recognition at which point it makes more sense to use the spectral power distribution so a low-density vapor-filled tube will have a few sharp points but something solid will have a more continuous emission spectrum so this is why materials have different colors based on their chemical composition and if we want to make something a specific color we just need to add a pigment which is just some material whose emission spectrum is of particular significance to us so that was reflection but what about light sources well there are two main types of light sources incandescent ones and luminescent ones incandescence is when an object produces light based on its high temperature this can be through things like combustion aka fire or black body gradation where the emission spectrum of a hot object is approximately wave shaped and the peak wavelength is inversely proportional to temperature for something cold like a human the peak is way in the infrared so we don't produce a visible light but for really hot things like stars the peak can be in or near the visible range so they produce visible light this is what we get for a 3000 kelvin star if we look at just the visible part there's a lot of reds and not so many blues this results in orange which you can see on the chromaticity diagram a 6 000 kelvin star has about even amount of every visible wavelength making it basically white and a 10 000 kelvin star has a lot of blues and not so many reds so its final color is light blue if we look at all the colors that can be produced by black body emitters we get a line called the plankian locus it starts off at red then goes to orange yellow white and finally light blue all this talk about stars might have you wondering about the most famous star of all the sun it's the perfect temperature to produce all wavelengths of visible light in approximately equal proportions making sunlight almost perfectly white this was famously demonstrated by isaac newton using a prism to refract sunlight the angle of refraction varies slightly based on wavelength which separates white light into individual wavelengths and this is the same property that forms a rainbows where the raindrops function as tiny prisms ideally we would get the spectral colors but the beam of light can never be perfectly uniform so the spectrum we actually get looks a bit different when newton saw this he divided it into five main colors which he called red yellow green blue and violet later on he added orange and indigo because he really liked the number seven this is the catchy acronym roycey biv and to be honest i kind of hate roy g biv you see it only really works with outdated color terms what newton called blue we would call cyan what he called indigo we would call blue and what he called violet we would call dark blue unfortunately people still use the acronym with modern color terms which leads to cyan getting left behind also it's worth noting that neither of these contain purple even though rainbows can contain purple that's due to something called supernumerary bands where a smaller and fainter rainbow forms and the red of the small one mixes with the blue of the big one forming purple anyway let's get back to sunlight even though sunlight is white the sky isn't white instead it's azur which is in between blue and cyan so why does the sky look like this well when you look at the sky you're not actually seeing direct sunlight instead you're seeing light that's been reflected by particles in the atmosphere since the particles are so small it leads to a phenomenon called rayleigh scattering where shorter wavelengths are reflected more often than longer ones because of this the emission spectrum of the sky ends up looking like this which ultimately results in azer meanwhile the sun itself looks slightly yellow because you're seeing the light that hasn't been reflected so the sun is a natural light source but in the past century artificial light sources have really taken off this can be through incandescence which is how lanterns and the first light bulbs work but modern technology has allowed us to make use of the other type of light source luminescence the first important type is electric discharge where a vapor-filled tube receives an electric current which ionizes the atoms causing them to emit light compact fluorescent lights or cfls achieve this with mercury vapor which produces ultraviolet light they then combine this with another type of light source fluorescence where a material called a phosphor receives high-energy light like ultraviolet and then re-emits it as something lower energy like visible light fluorescent light bulbs are a lot more energy efficient than incandescent ones but even more energy efficient would be leds diodes only let electric current flow in one way and they achieve this by combining two different types of semiconductors electrons jump from one side with excess electrons to another side with missing electrons this new side is more energetically favorable and so the electrons release this energy in the form of photons with energy equal to the amount lost giving them very specific wavelengths the current gives a constant supply of new electrons which results in the light emitting diode emitting light so let's compare the emission spectra of the three different light sources you can see that incandescent lights produce a very smooth emission spectrum so they pretty much only come in yellow the emission spectrum of cfls indicates where you would find spectral lines and then leds are able to specialize in specific wavelengths now we can take a look at how computer screens work we've seen how every color is just some combination of spectral colors so it makes sense that computers would make many different colors by combining just a few which are known as primary colors the area of colors we can achieve with a system is called its gamut and we want to maximize the gamut while using as few primary colors as possible to get a non-zero area we need at least three primary colors and just looking at the chromaticity diagram it's pretty clear what we should pick since the three primary colors are red green and blue technology that uses them is called rgb technology unfortunately though we can't exactly produce these pure spectral colors the first type of rgb technology was crt or cathode ray tube and its gamut looks like this it makes use of phosphorescence which is similar to fluorescence and that they both use phosphors the blue and green phosphors were pretty easy to find the green kind uses zinc sulfide activated with copper and the blue kind uses in sulfide activated with silver the red kind though was actually really hard to find and this significantly delayed the development of color tv but eventually one was found atrium oxide sulfide activated with europium the emission spectra of the three phosphors generate the primary colors that we saw earlier so each pixel has all three types of phosphors and to set that pixel to the correct color each phosphor is set to a specific illuminance and these combine to form the color these pixels are so small that we can't even distinguish the red green and blue sections and instead just see the pixel as a single color modern screens don't use crt though they use lcd or liquid crystal display which can have a better gamut but if this is the gamut of the screen you're watching this on how does it possibly produce the full chromaticity diagram well it kind of cheats a bit and just shows the colors that are as close as possible for that reason these images are only approximations the way lcd works is very complicated involving polarizing the light which basically changes the angle at which the waves are oriented but it still works by the same basic concept of combining three primary colors what about printers though they can't just combine light sources because the result should be a piece of paper which isn't a light source it's just a reflector so instead of additive color mixing where you start with black and then add the primary colors in the form of light sources printers use subtractive color mixing this is where they start with white which reflects all colors and then they subtract the primary colors from it to get the desired color but they're not physically removing anything from the paper in fact they're adding something so what is it that they're adding well instead of subtracting red green and blue they add anti-red anti-green and anti-blue but what does that mean well a green object will only reflect green wavelengths but an anti-green object will reflect everything but green the resulting color is magenta but that's kind of irrelevant all we really care about is the anti-color property if we take the anti-colors of red green and blue we get cyan magenta and yellow so printers can make any color by starting with white paper and then adding the three pigments most printers also use a fourth pigment black which helps make things darker the black pigment is called the key and so this printing technology is known as cmyk the way images are generated with printers is very similar to how it was with screens but instead of activating each light source at a different luminance they distribute particles with different sizes to create the image so we've seen how computers make colors by combining three different primary color light sources at different luminance levels this gives us three variables so just like with cone response we can assign each one to an axis of 3d space each one has a max value which we'll call 1 so again it gives us a cube of potential colors we can make by combining these unlike with cone response though each variable can be controlled independently which means we can actually reach every location within the cube and if we fill in the cube with the colors that we get for each combination we get the one and only rgb cube but it's important to note the differences between this and the lms space for example a pure green here is found at 0 1 0 but that same point in the lms space was the impossible color hyper green and even though the rgb cube is a full cube it still has fewer colors than the visible gamut in the lms space and this can be easily seen in the chromaticity diagram anyway the rgb cube is how computers generate colors they assign a value to red green and blue content for each pixel these take integer values from 0 to 255 but why 255 well it has to do with binary which is how computers store data in base 10 we have 10 digits 0 through 9 but in binary there are only two 0 and one binary digits are called bits and when you have eight of them it's called a byte the number of combinations for eight bits is two to the eight or two hundred fifty-six and each combination corresponds to a number from zero to two fifty-five so by limiting red green and blue to 8-bit integers computers only need 3 bytes to represent a color but when we talk about computer colors we usually use hex codes they use hexadecimal which is base 16. it has the digits 0 to 9 from base 10 and then for the remaining 6 digits it uses letters a to f counting in hexadecimal is just like counting in base 10 but each digit can go up to f before you have to change the next one with two hexadecimal digits you have 16 squared or 256 combinations which is the perfect amount for one byte of information so to form a hex code you take red green and blue content of the color and then convert them to hexadecimal and put them together to form a six character string and if you want to convert a hex code back into the red green and blue components here's how so first you separate it into three two-digit sections then for each one convert any letters into their corresponding numbers then you multiply the left one by 16 and add it to the right one and this gives you the three numbers so this rgb system is cool but it's not the most intuitive depending on the red and green values the blue axis can go from black to blue orange to pink brown to purple and a lot more it would be more intuitive if each axis always controlled the same thing like how bright the color is and this is exactly what the hsv color space attempts to do its three variables are called hue saturation and value saturation and value range from 0 to 100 while hue ranges from 0 to 360. so if you remember from earlier changing a color's luminance doesn't affect its chromaticity so it makes sense for one of the variables to control luminance and that's approximately what value does that leaves us with the other two variables to describe chromaticity and at this point you might notice something all of the colors seem to get lighter towards the middle eventually becoming white in the very center and so it makes sense that one of the variables should represent distance from the middle that saturation and it leaves hue to measure angle around the center the chromaticity diagram is based on the cie color space which itself is based on the lms one since this is on the computer though it should be based on the rgb cube so we need an algorithm to convert rgb values into hsv values the way to do that is as follows so first of all we're going to divide rg and b by 255 so that they range from zero to one i'm calling these lowercase rg and b then we're going to find the minimum and maximum out of the three these will be m1 and m2 respectively then finally delta is the difference between those now we have all the intermediary variables so we'll start with value it's the easiest because it just equals m2 times 100. this means that surfaces of constant value correspond to three phases of a cube where lower value means a smaller cube next to saturation it's defined by s equals delta over m1 times 100. this means that lines of constant value and saturation correspond to triple l's along the cube where lower saturation means they're closer to the triple point also if you get zero over zero it just means that saturation has no effect on the color so we just pick zero lastly there's hue it basically represents distance along this triple l where we start on the red face and move anti-clockwise the length of any one half l is equal to delta so if we divide the distance by delta it will range from zero to six we'll call this value x then if we multiply by 60 it will range from 0 to 360 like we want but the way you calculate this distance differs depending on which face you're on if red is the maximum it means you're on this left face so distance is g minus b if g equals b you get x equals zero on the right endpoint g minus b equals delta so x equals one and on the other end point g minus b equals negative delta so x equals negative one this means x ranges from negative one to one but we don't want negatives so we use the modulo operator by six to make it go from zero to one and then five to six finally we multiply by 60 to get this one-third of the hew formula now if green is the maximum it means you're on the right face so the distance is b minus r it's basically the same concept but this time we add 2 to make it from 1 to 3. this accounts for the starting point still being on the red face this gives us the next third of the hue formula finally if blue is the maximum you're on the top face so we use r minus g the same thing applies but we add four this time and this gives us the full hue formula again if you get zero over zero it just means that hue doesn't affect the color so we just use zero and with that we finally have the hsv color space if we arrange it like before with each axis being a different variable then it forms the square prism shape which is certainly interesting but there's a better way cylindrical coordinates use two distances and one angle to represent points in space if we set the angle theta equal to hue and the distances r and z equal to saturation and value respectively then we get this beautiful cylinder but you might notice something the top face has many different colors while the bottom face is all black so it makes sense that it should end at a single point and we can achieve this by setting r equal to saturation times value this gives us the hsv cone which is my favorite way to arrange colors and if you've ever seen a color picking tool like this it basically takes a cross section of the cone at the desired hue now that we have a great way to pick colors let's make a color scheme so the rgb cube is a great place to start because we can take a three by three by three grid of points and it gives us 27 colors this is the basis for my color scheme although i do modify them a bit but instead of viewing them in the rgb cube we can take a look at where these points end up on the hsv cone and it makes this really nice pattern which helps us organize them better and now we can start naming them so first of all in the center of each layer we have black white and gray then in the top layer we have what i call the main six these are red yellow green cyan blue and magenta these along with black and white make up the eight corners of the rgb cube then the next set of six is what i call the in between colors because they're in between pairs of the main six these are orange chartreuse turquoise purple and ceres my logo includes the main sticks along with orange and purple to form what i like to call the eight hue interpretation because i think these eight are the most distinct the remaining colors can be divided into two groups of six lighter versions of the main six and darker versions of the main six on screen are the names i've chosen for them but these names are not yet finalized my full color scheme includes these 27 as well as nine more which i think are distinct enough to be separate if you're interested in the hex codes then here they are but keep in mind my color scheme is still a work in progress and now we finally reached the end of the video if you have any questions feel free to ask in the comments and i'll do my best to answer this is by far the longest video i've ever made and it took a lot of work so if you want to make it all worth it i would very much appreciate if you like the video and subscribe to the channel i have a lot of other videos you can watch and i have more coming soon including relativity part 4 which you won't want to miss out on thank you for watching and i hope to see you soon you
Info
Channel: Kuvina Saydaki
Views: 169,686
Rating: undefined out of 5
Keywords: math, science, colors, colours, physics, fun
Id: gnUYoQ1pwes
Channel Id: undefined
Length: 42min 34sec (2554 seconds)
Published: Fri Aug 12 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.