bradyaturner / lights

A Ruby library & CLI for interacting with Philips Hue
MIT License
37 stars 7 forks source link

Color conversion algo's #3

Open bobbyduhbrain opened 10 years ago

bobbyduhbrain commented 10 years ago

Here is a list of them:

http://www.cs.rit.edu/~ncs/color/t_convert.html

bradyaturner commented 10 years ago

Also this: http://www.everyhue.com/vanilla/discussion/comment/3147

which links to this: https://github.com/PhilipsHue/PhilipsHueSDK-iOS-OSX/blob/master/ApplicationDesignNotes/RGB%20to%20xy%20Color%20conversion.md

bobbyduhbrain commented 10 years ago

After further thinking about it, color conversion should happen in the form of setters for the lights. Since you can set xy, ct, and hue/saturation, it would make sense to me to add the methods to lights class:

def set_xy(r,g,b)

def set_ct(r,g,b)

def set_hsl(r,g,b)

The methods should take RGB since, imo, most programmers are using RGB when they're thinking about colors. Of course, I am open to discussion, that's just my thoughts on it.

bobbyduhbrain commented 10 years ago

Oh...and should conversion happen inside these methods?