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

Suggestion: Wheel Lightness Step 0 is hexString=#000000 flag that change Step 0 to Step 1 #65

Closed
creppu opened this issue Apr 16, 2019 · 1 comment
Assignees

Comments

@creppu
Copy link

creppu commented Apr 16, 2019

I use iro.js to control my lights.
At night I want the lowest brightness available for the color.
At step 0, the light goes out and I always try to touch step 1 to reach it.
Maybe a flag would be nice to change the behavior on step 0.
Off, or the lowest possible brightness.

sliderStep0

@jaames jaames self-assigned this Apr 16, 2019
@jaames
Copy link
Owner

jaames commented Apr 16, 2019

You'd like to limit the color's brightness so that it never reaches 0?

The easiest way to do this is by using the color picker's color:change event to update the color if the brightness falls below 1:

colorPicker.on("color:change", function(color) {
  var hsv = color.hsv;
  // don't allow the color's brightness to be smaller than 1
  if (hsv.v < 1) {
    color.hsv = { h: hsv.h, s: hsv.s, v:1 }
  }
}

I'd prefer not to add a built-in option/flag for this, since the use-case is quite niche and it would only add more bloat and potential for bugs.

Hope that snippet helps, though :)

@jaames jaames closed this as completed Apr 16, 2019
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

2 participants