Mobile app version of vmapp.org
Login or Join
Murray432

: How are hexadecimal color codes added together to produce a color in HTML? I know that web colors use RGB color model in which red, green, and blue colors are ADDED together in various ways

@Murray432

Posted in: #Colors #Css #Html

I know that web colors use RGB color model in which red, green, and blue colors are ADDED together in various ways to reproduce a broad array of colors. Now, suppose I have a color: #800080 (which is purple), Is it possible to find the hex values of those two colors which were added to form this color?

Moreover, are there multiple possibilities or ways in which this color could be achieved ( for eg. in decimal number system ,the number 6 can be achieved in multiple ways like: 3+3=6, 4+2=6, 5+1=6 or 8-2=6,10-4=6 etc) or is there just one way in which two specific colors should be added to get a desired color?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

2 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

When the red, green, and blue values are "added" together, it really means "concatenated". Your #800080 color code can be split up like this:




Red: 80 out of FF or 50%
Green: 0 out of FF or 0%
Blue: 80 out of FF or 50%


It is the only 6 digit hexadecimal color code that will give that exact shade of purple. Other shades of purple can be produced when there is red and blue in roughly equal amounts without any green.


0xFF00FF - The brightest purple with the most red and green that is possible
0x330033 - very dark purple

10% popularity Vote Up Vote Down


 

@Shelton105

See the following image:

from ColorHexa

The way this works:

Each of the three colors has 16 shades from 00 to FF(Hex) which translates to 0 to 255(Decimal). You'll also notice that 255 is the equivalent of all ones in a Byte. Stay with me here: While remembering you have a Full byte for R, a Full Byte for G, and a full Byte for B, now you must add the idea you learned in Art Class. Given only 3 Primary Colors, can you create all other colors? On a piece of paper color a Red Circle, and in that circle color a smaller Blue Circle(using crayons). Where the circles intersect will be some form of purple.



The picture I posted above equates to half a byte of Red + Half a byte of Blue + No bytes of Green. Consider this:

- Still purple, although the shade is changing.

This Color is still purple but as we add in Green, we end up at Gray:

- Gray

It doesn't matter where we start, as at half a byte of each is always gray. Mixing each of these 3 Primary Colors will result in creating colors, much like coloring crayon circles. Knowing this, you can apply some basic color theory to find complementary colors using Sites like Paletton.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme