15

What are ranges of cold and warm colors (http://www.diy-bathroom-remodel.com/images/color_wheel.gif) in RGB?

Fabian Fagerholm
  • 4,099
  • 1
  • 35
  • 45
Sarah
  • 281
  • 3
  • 7
  • 13
  • In RGB, cool colors have more blue than red. In HSL, cool colors are between the hue degree ranges of 91 and 269 (note: 90, and 270 are neither cool or warm). – tim-montague Nov 25 '18 at 23:42

7 Answers7

46

Taking the image you linked to as a reference of what is "warm" and "cold", we get the following.

Colour wheel

  • The hottest colour is completely red (R=255, G=0, B=0).
  • The coldest colour is completely blue (R=0, G=0, B=255).

So the more R you have, the warmer the colour, and the more B you have, the cooler the colour. The G takes you through shades of turquoise, green, and yellow, each being increasingly warmer. When G is zero, you move in the lower left diagonal of the circle when R and B change. As G approaches 255, you cross over the upper right diagonal when R and B change.

However, the adjacent warm and cool colours have a different amount of green in them. The red immediately below the diagonal line has less green than the red immediately above it. The blue immediately below the diagonal line has less green than the blue immediately above it. This colour wheel looks like it doesn't represent the RGB space all that well especially in the blue end of the spectrum.

Ultimately, what you perceive as warm and cold depends on your monitor settings and light conditions. A lot of it is also your perception and cognition – what you think is warm or cold. In an image, the colour contrasts will affect your judgement. An "in-between" colour next to a clearly cool colour will look warm, but if the same colour is next to a clearly warm colour, it will look cool. Take a look at this colour wheel:

colourwheel

Here, every single 24-bit colour is shown (8 bits for each of R, G, and B), and the RGB values for the top, right, bottom, and left colours are shown. To my eye, there are more "cool" colours than "warm". Hope this helps you decide what the RGB values are for what you perceive as cool and warm colours.

Bonus: In the image above, you can also see the colours expressed in the hue, saturation, and value (HSV) colour model. Hue basically encodes the colour. Saturation encodes how "full" the colour is – less saturation makes it more "bleak", ie. white. Value encodes how dark it is – less value makes it more black, and also makes the white of the saturation more grey. Hue goes from 0 to 360 and corresponds to the angle of a circle, with 0 being totally red, 90 being a sort of neon green, 180 being bright blue, 270 being bluish purple, and 360 going back to red again. S and V go from 0 to 100 and will influence the exact shade – these examples are with S=V=100.

To my eye, H values in the ranges 0-80 and 330-360 are warm while H>80 and H<330 are cold (approximately).

You may want to open the colour selector in your favourite paint program. They can usually show HSV and RGB side by side and let you play with a colour wheel and see the effects on the HSV and RGB numbers. If you don't already have one, I would suggest GIMP. It has the colour wheel I've been using to get the numbers for this answer.

Bonus 2: All of the above assumes a subjective assessment of what is warm and what is cool. I think the only way to make an objective measurement of colour temperature is to measure it and express it on a temperature scale. Often Kelvin seems to be used. This measure takes into account not only shade of the colour, but its brightness (or how much light it emits) too. If you have a modern monitor, it probably has a temperature setting with some Kelvin values to choose from. It is possible to calculate the temperature of each RGB colour on your display, as long as you know the temperature of your white (the white balance). However, this calculation is very complex and I don't know how to do it. You may find Bruce Lindbloom a good source for further information, or any book on colour science. But I guess this is more than you bargained for with your question... ;-)

Fabian Fagerholm
  • 4,099
  • 1
  • 35
  • 45
  • 1
    I would simply say: convert to HSV/HSL and then simply determine the warmness based upon H. No need to think around with what to do with green :-) – user562374 Jan 06 '11 at 13:49
  • @user562374: I completely agree and would have posted that as an answer (complete with sample conversion code), except that the question explicitly calls for a solution the RGB color space. – Cody Gray - on strike Jan 06 '11 at 14:01
  • @user562374, @Cody Gray: Yes, HSV has some benefits like this, but the question called for an RGB solution. Thanks for your comments on this – I was inspired to update the answer with some HSV bonus stuff. – Fabian Fagerholm Jan 06 '11 at 14:57
4

already answered but need to add this:

If you are interested in physical temperature and color dependencies then this is the scale you are looking for:

Black body Temperature color

It is the color of light emitting from blackbody of given temperature. In astronomy is this used for star color classification (like BV color index).

It also can be used for indirect temperature measurements.

Spektre
  • 49,595
  • 11
  • 110
  • 380
4

Looks to me like

if (B>R) { 
    color=cool
} else { 
    color=warm
}

is a pretty good approximation. You can check this out on your color wheel using: http://www.colorzilla.com/firefox/

Mike C
  • 3,077
  • 22
  • 29
  • 1
    Perhaps a good approximation, but you'll need to factor the green value in there somewhere if you want to determine this with any accuracy... For example, (50, 200, 0) produces a nice medium green color that would probably be considered a "cool" color. – Cody Gray - on strike Jan 06 '11 at 13:32
  • I didn't feel completely comfortable with ignoring green, but it seems to me that classifications such as 'warm' and 'cool' are subjective enough that 'determining with accuracy' may be over-engineering a bit... I guess it depends on the requirements. – Mike C Jan 06 '11 at 13:58
  • You're absolutely right about the subjectivity. Culture, through language, determines what people cognize as different colours and variants of the same colour. For example, some languages use the same word for green and blue, and even the same word for blue and black (eg. http://en.wikipedia.org/wiki/Distinguishing_blue_from_green_in_language). But whether or not people actually *see* different or the same colours is another matter (eg. http://en.wikipedia.org/wiki/Linguistic_relativity_and_the_color_naming_debate). – Fabian Fagerholm Jan 06 '11 at 15:09
  • Warm colors have more red, and cool colors have more blue. What if Red=100 and Blue=100...? Your code says the color is `warm`... but because the color has equal parts red and blue... the output should be `undefined`... it is not warm or cool. – tim-montague Nov 25 '18 at 23:38
  • Fair enough, I guess the if should be something more like `if (B!=R && B>R)` :-) – Mike C Nov 28 '18 at 14:08
1

I've found these parameters satisfactory

For Warm color :

  • R from 128 to 255
  • G from 0 to 128
  • B from 0 to R

For Cold color :

  • R from 0 to B
  • G from 0 to 255
  • B from 128 to 255

Note that high green makes the color more cold (in my view but that's debatable ^^), that's why it's restricted for warm colors but not for cold ones.

Johann
  • 73
  • 7
0

Warm colors have more red, and cool colors have more blue.

In RGB:

red = 0
blue = 0

if (red > blue) {
  isWarmColor = true
  isCoolColor = false
}
else if (red < blue) {
  isWarmColor = false
  isCoolColor = true
}
else {
  isWarmColor = false
  isCoolColor = false
}

In HSL:

hueAngle = 0

if (hueAngle < 0 || hueAngle > 360 || hueAngle == 90 || hueAngle == 270) {
  isWarmColor = false
  isCoolColor = false
}
else if (hueAngle > 90 && hueAngle < 270) {
  isWarmColor = false
  isCoolColor = true
}
else if (hueAngle < 90 && hueAngle > 270) {
  isWarmColor = true
  isCoolColor = false
}
tim-montague
  • 16,217
  • 5
  • 62
  • 51
0

Simple and accurate:

    def is_hot(a):
        return (a[..., 'RED'] > 128)

where 'RED' stands for the index of the red channel in the array a.

This works -- you can see for yourself by: (a) looking at the second wheel by Fabian Fagerholm and/or (b) go to the following link and move the bar up and down towards the two warm ends.

https://www.colorspire.com/rgb-color-wheel/

Anon
  • 619
  • 1
  • 9
  • 18
0

For me below calculation, with the inclusion of saturation, gives a better result. Since fully desaturated colors like Black, White and Gray are considered neutral colors.

        if (hueAngle == 90 || hueAngle == 270 || (hueAngle == 0 && saturation == 0))
        {
            isWarmColor = false;
            isCoolColor = false;
        }
        else if (hueAngle > 90 && hueAngle < 270)
        {
            isWarmColor = false;
            isCoolColor = true;
        }
        else
        {
            isWarmColor = true;
            isCoolColor = false;
        }
vinayak hegde
  • 2,117
  • 26
  • 26