title: Philips hue, convert xy from api to HEX or RGB
body: <p>I am making a web interface to manage my hue lamps, but i am struggling when it comes to color handling..</p>
  
  <p>The api of the lamps provides me the x and y coordinates from <a href="http://en.wikipedia.org/wiki/CIE_1931_color_space" rel="noreferrer">http://en.wikipedia.org/wiki/CIE_1931_color_space</a></p>
  
  <p>But not the z value.</p>
  
  <p>I think i must calculate the z from the brightness value or saturation value  (0 to 255).</p>
  
  <p>but i am terrible at colors, and math :p.</p>
  
  <p>I tried to use thoses functions <a href="https://github.com/eikeon/hue-color-converter/blob/master/colorconverter.ts" rel="noreferrer">https://github.com/eikeon/hue-color-converter/blob/master/colorconverter.ts</a></p>
  
  <p>But as i saw in the comments, thoses functions do not provide correct values...</p>
  
  <p>Could someone help me here please ? ☺ </p>
  
  <p>ps : i need a javascript function.</p>