title: Set background color based on outdoor temperature
body: <p>Heyoh SO,</p>
  
  <p>I have a temperature widget to implement on a project I am working on.
  Nothing is specially difficult, I've got a free API to retrieve the datas that I need ect.</p>
  
  <p>BUT, the lovely designer who works with me would have a color feature for which I've got no good idea to start with...</p>
  
  <p>He would to define a background-color depending on the current weather temperature.</p>
  
  <p><img src="https://i.stack.imgur.com/Ir87A.png" alt="Temperature color schema"></p>
  
  <p>I mean if the temperature is cold, like -20, the background color should be blue / violet / any cold color; and when it's warm, like 25, it should have a hot background-color like orange / red.</p>
  
  <p>I think I could easily work with an array of "temperature steps", but I would prefer to work with a function that could define the color depending of the temperature. I know it's strange, I don't know if there is an algorithm to define a color by it's temperature color...
  This article is helpfull <a href="http://en.wikipedia.org/wiki/Color_temperature" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Color_temperature</a> but quite complicated, if someone has any idea, even for a beginning, I am very interested !</p>
  
  <p>I saw this thread:
  <a href="https://stackoverflow.com/questions/7229895/display-temperature-as-a-color-with-c">Display temperature as a color with C#?</a></p>
  
  <p>But I'm not using C# and I don't want to, so if there is a solution in JavaScript, it would be perfect. I can eventually work with PHP or NodeJS if there is a server-side need.</p>
  
  <p><strong>EDIT - Answer</strong>:</p>
  
  <p>Finally, I didn't have the choice to use a real colors gradient array, because of the graphic needs.
  But I still had to mix the colors of the closest steps depending of the temperature !
  I wrote a small JS library to do that, that you will be able to find on GitHub soon, I'll post the link here.</p>
  
  <p>You can find it here:</p>
  
  <p><a href="http://color-mix.it/" rel="nofollow noreferrer">The presentation website of the project</a></p>
  
  <p><a href="https://github.com/Flo-Schield-Bobby/colormix" rel="nofollow noreferrer">Or the github project</a></p>