title: Get a "rainbow gradient" from numeric values - PHP
body: <p>I want to have a gradient with rainbow colors.</p>
  
  <p>I have numeric values, the maximum value is the color Red, and minimum value is the color Blue.
  I try to find an algorithm to have proportional colors, i.e the half will be Green, between half and max will be Yellow or Orange....</p>
  
  <p>I begin with this : <a href="https://stackoverflow.com/questions/6777472/get-color-value-from-numeric-values">Get color value from numeric values</a>
  But my function is not correct, if someone can help me... I try with HSV, RGB ... But I am more WebDesigner than Developper..
  Thanks !</p>
  
  <p>EDIT -----------------</p>
  
  <p>This help ! Thanks a lot, I was sure that Value must be variable, but only with the Hue I get the right thing... </p>
  
  <pre><code>$h = ($value * 360) / $max;
  
  $color = HSV_TO_RGB($h / 360, 1, 1);
  </code></pre>
  
  <p>First time, I forgot to divide by 360 to have a value between 0-1... I am an idiot. The HSV_TO_RGB function can be easily found on Web (hsv to rgb php in Google).
  I get the right colors now, using a boucle.</p>
  
  <p>Thanks a lot.</p>