

Get the RGB values from your color object and convert them to be between 0 and 1. We start with the color to xy conversion, which we will do in a couple of steps: If you have light which is not one of those, you should use: The advantage of this model being settable is that you can decide if you want to limit the color of all lights to a certain model, or that every light should do the colors within its own range.Ĭurrent Philips lights have a color gamut defined by 3 points, making it a triangle.įor the hue bulb the corners of the triangle are:įor LivingColors Bloom, Aura and Iris the triangle corners are: The model parameter of both methods is the modelNumber value of a PHLight object. The color to xy/brightness does not return a value, instead takes two pointers to variables which it will change to the appropriate values. The method signature for converting from a color to xy and brightness values: + (void)calculateXY:(CGPoint *)xy andBrightness:(float *)brightness fromColor:(UIColor *)color forModel:(NSString*)model The method signature for converting from xy values and brightness to a color is: + (UIColor *)colorFromXY:(CGPoint)xy andBrightness:(float)brightness forModel:(NSString*)model In the PHUtility class contained in the Hue iOS SDK you can see our Objective-C implementation of these transformations, which is used in our iOS SDK for hue. For example, the hue bulbs are very good at showing nice whites, while the LivingColors are generally a bit better at colors, like green and cyan.

It is important to differentiate between the various light types, because they do not all support the same color gamut. The conversion between RGB and xy in the CIE 1931 colorspace is not something Philips invented, but we have an optimized conversion for our different light types, like hue bulbs and LivingColors. #Conversion between RGB and xy in the CIE 1931 colorspace for hue
