How can i know what combination of color produce certain color in RGB hex?

For example, black #000000 in hex and RGB(0, 0, 0). red is ##FF0000 in hex andRGB(255,0,0)`.

1

3 Answers

In hex, the colour is coded as #RRGGBB, where each pair of digits RR, GG or BB represents the intensity of red, green or blue respectively as a hexadecimal value between 00 and FF (0 and 255 in decimal). You can also write rgb(RRR, GGG, BBB) to mean the same thing, where the RRR, GGG, and BBBare decimal numbers.

For each number, 0 means black, and 255 (or FF) means full intensity.

In hex, you can also use three digits: #123 means the same as #112233.

Although you might be able to work out in your head what sort of colour a particular mix of red, green and blue might give you, it's probably easier to use a colour chart. See for some examples.

In CSS, you can also use keywords like orange to represent common colours - these are much easier to remember.

For more info, see Applying color to HTML elements using CSS.

0

I think that is better you use a conversor, like this:

1

If you look at it closely, you'll notice that the hex of RGB(r, g, b) is just the three values individually converted to base 16 and joined together, prepending with a '#'.

As an example, let's check out red.

In RGB, red is defined as RGB(255, 0, 0). To convert this to hexcode, we just need to get the first number of the RGB first. In our case, that is 255. The hex of 255 is FF. So, "FF" would be the first color in our hexcode.

The remaining colours green and blue both have a value of 0. Converting those two to hex would give us 00. We append both 00s to the hexcode, and we will get FF0000. That is the hexcode of red!

Notice a pattern in hexcodes and rgb()? The first two numbers refers to the red value, the second two refers to the green value, and the last two refers to the blue value.

RGB matching with hexcode

Just like what JRI said, #RRGGBB or in rgb, RGB(RRR, GGG, BBB).

The values of red, green, and blue can range from 0 to 255. The combination of the three will give you a maximum of 16,777,216 colours to choose from. So how do you choose the colour?

It's going to be difficult to find the right balance of colours in your head. The higher the value of red is compared to the rest, the more red the colour will be. The higher the value of green is compared to the other colours, the more green it will be, and vice-versa.

You could think of red as providing the darkness of the overall colour; the blue providing the lightness of the colour; and the green providing a good middle ground.

As much as possible, use a colour chart or use the colour picker from an app or website to make things easier.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy