lifxjs icon indicating copy to clipboard operation
lifxjs copied to clipboard

More natural color values

Open meodai opened this issue 10 years ago • 6 comments

I saw that the official API uses int16 numbers for the colours, but it feels unnatural to me. Would be nice to make abstraction of that at let us use a more natural writing style. something like: lx.lightsColour(170, '50%', '45%', .6, '1000ms') or maybe just provide a helper function that will do the math.

I think it would make it dramatically easier to use lifxjs for anyone likes me who comes from the frontend side of JS.

For me this is an issue, but please consider it as a suggestion.

meodai avatar Jan 06 '15 14:01 meodai

+1 of this. Or allow me to drop in a Number from 0 to 1. I'm an EmberJS dude, non base 10 numbers are a bit over my head, and I'm assuming other people that wanna' just use this library to hack away on stuff.

cdl avatar Apr 18 '15 01:04 cdl

I've used this function to convert values to the hex16 value:

function hex16(val) {
    val &= 0xFFFF;
    var hex = val.toString(16).toUpperCase();
    return ("0000" + hex).slice(-4);
}

However, i'm not sure what ranges hue, brightness etc.. accept. Is that documented anywhere?

kevincannon avatar Jun 30 '15 15:06 kevincannon

@kevincannon You find the range information in the lifx docs https://github.com/LIFX/lifx-protocol-docs/blob/master/messages/light.md#hsbk

MariusRumpf avatar Jun 30 '15 16:06 MariusRumpf

@MariusRumpf - neat, thanks for the info!

BTW - is node-lifx what I should be using with lights with the new Firmware? I noticed some functions broke since I updated.

kevincannon avatar Jun 30 '15 19:06 kevincannon

node-lifx is still work in progress and missing key features like turning on or off the lights or set the colors. When it is in any working state I will publish it on npm and write docs for it. Since that I will help out with questions here where I can.

MariusRumpf avatar Jul 01 '15 07:07 MariusRumpf

Great, thanks for the info. I was a bit confused. Luckily I still have one LIFX with the old firmware, so I can play with that.

Great library. It's been really amazing to use it! Thanks so much.

kevincannon avatar Jul 01 '15 07:07 kevincannon