Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More natural color values #33

Open
meodai opened this issue Jan 6, 2015 · 6 comments
Open

More natural color values #33

meodai opened this issue Jan 6, 2015 · 6 comments

Comments

@meodai
Copy link

meodai commented Jan 6, 2015

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.

@cdl
Copy link

cdl commented Apr 18, 2015

+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.

@kevincannon
Copy link

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?

@MariusRumpf
Copy link

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

@kevincannon
Copy link

@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.

@MariusRumpf
Copy link

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.

@kevincannon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants