title: Convert XY Values to RGB
body: <p>I am using the Android Philips Hue SDK and I am currently having an issue with converting the light bulbs XY value to RGB. </p>
  
  <p>I have looked at <a href="http://www.developers.meethue.com/content/phutilitiescalculatergbfromxy" rel="nofollow">this code</a> provided in a forum on Philips Hue website and the code has been provided by someone from Hue Support. </p>
  
  <p>I have the following function using this code from the forum:</p>
  
  <pre><code>public static int[] convertXYToRGB(float[] xy, String lightModel)
      {
          int color = PHUtilities.colorFromXY(xy, lightModel);
          int r = Color.red(color);
          int g = Color.green(color);
          int b = Color.blue(color);
          return new int[] {r, g, b};
      }
  </code></pre>
  
  <p>And I am calling it like:</p>
  
  <pre><code>int hue = lightState.getHue();
  float[] xy = PHUtilities.calculateXY(hue, item.light.getModelNumber());
  
  int[] rgb = Utilities.convertXYToRGB(xy, item.light.getModelNumber());
  </code></pre>
  
  <p>Looking at the RGB value I get back it seems to be the wrong colour. For example, using the official app, I set one of my light bulbs to red. When I run my app, the RGB value that comes back is a pale yellow. </p>
  
  <p>Has anyone else experienced this or know how to resolve this issue?</p>