Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I just answered a question in which the OP basically wants a mathematical model for doing interpolation between color points in a way which would look natural to the human eye (and which presumably is not what linear interpolation would produce).

My answer was to pre-pick N colors and simply project from the initial input range to these color bands.

Which led me to wonder... how is it done here on SO?

share|improve this question
Can you point to a post that has comments with upvote counts in different colors? – Gabe Apr 4 '11 at 0:15
@Gabe: The highest voted question (…) has some variety. – Jon Apr 4 '11 at 0:16
I see. The styles are "cool", "warm", "hot", and "supernova". – Gabe Apr 4 '11 at 0:23
Translate RGB to the HSL color space. Different S. It's a bit off, they probably picked them from a table. – Uphill Luge Apr 4 '11 at 0:33
up vote 11 down vote accepted


.supernova {
color: #FE7A15 !important;

.hot {
color: #CF7721 !important;

.warm {
color: #9B764F !important;

.cool {
color: #999 !important;


// e.g. options = { min: 15, max: 300, setIsValid: function }

var max = options.max;

var css = cur > max * 0.8 ? "supernova" : cur > max * 0.6 ? "hot" : cur > max * 0.4 ? "warm" : "cool";
share|improve this answer
Thanks for taking the time to dig. – Jon Apr 4 '11 at 16:49
I love the shorthand if statements in the last line. – toniedzwiedz Sep 26 '12 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .