sgry / svnhue

Do What The F*ck You Want To Public License
6 stars 0 forks source link

Allow colors to be parseable strings (RGB, HSL, Hex) #3

Open janmartenjongerius opened 11 years ago

janmartenjongerius commented 11 years ago

Allow for colors to be values you'd enter in an image manipulation program or simple CSS stylesheets.

As far as I grasp the subject, the models already accept HSL, only by splitting off the Lightness part off as CT.

RGB and Hex (#000) colors can be translated to HSL, which in turn requires minimal translation to the native colors. Perhaps there exists a ratio between CT and L, but that's something one can look up or reverse engineer.

It would allow for the following code:

$Lo_HueState->setColor(
  array(
    'name' => 'white',
    'hex' => '#FFF',
    // X, Y
    'xy' => array(0.143, 0.451)
  )
);

See https://github.com/sgry/svnhue/issues/2 for a reference to the structure I used in this example.

janmartenjongerius commented 11 years ago

Additionally you could add a translation from the current color to either color mode, through methods like:

sgry commented 11 years ago

If I knew how to convert RGB colors to either hue/sat or xy it would aready be in there. The Hue bridge doesn't use proper HSL as far as I understood it. The CT colormode is only for different whites. Cold (154) to warm (500). My knowledge in color stuff is very limited. I will leave this issue open and look into it! Thanks!

sgry commented 11 years ago

The official API by Philips just got released. Ars Technica has a little paragraph about the colorsettings: http://arstechnica.com/gadgets/2013/03/philips-delivers-promised-dev-docs-for-colorful-hue-led-lights/

Seems I have plans for next weekend ;-)

janmartenjongerius commented 11 years ago

Have fun

On Tue, Mar 12, 2013 at 10:37 AM, sgry notifications@github.com wrote:

The official API by Philips just got released. Ars Technica has a little paragraph about the colorsettings:

http://arstechnica.com/gadgets/2013/03/philips-delivers-promised-dev-docs-for-colorful-hue-led-lights/

Seems I have plans for next weekend ;-)

— Reply to this email directly or view it on GitHubhttps://github.com/sgry/svnhue/issues/3#issuecomment-14766045 .