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

Get color.hsvString #148

Closed
niwanta opened this issue Dec 2, 2020 · 4 comments
Closed

Get color.hsvString #148

niwanta opened this issue Dec 2, 2020 · 4 comments

Comments

@niwanta
Copy link

niwanta commented Dec 2, 2020

1)Is it possible to get color.hsvString?
2)If not I can get color.hsv.h, color.hsv.s, color.hsv.v separately but how to get percentage(%) of color.hsv.s, color.hsv.v values?
3)I add hue slider, and is it possible to lock the hue slider on a given value when init?

component: iro.ui.Slider,
options: {
sliderType: 'hue'

4)Is it possible to increase the range 100 and above?

@jaames
Copy link
Owner

jaames commented Dec 8, 2020

Is it possible to get color.hsvString.

Yeah, I'll implement something like that in the future. My plan is to add support for most of the CSS Level 4 spec in the next major version of iro.js

If not I can get color.hsv.h, color.hsv.s, color.hsv.v separately but how to get percentage(%) of color.hsv.s, color.hsv.v values?

I don't really understand what you mean here? hsv.s and hsv.v are already in the range of 0 to 100, like a percentage.

I add hue slider, and is it possible to lock the hue slider on a given value when init?

Kinda, you can force one of the color channels to always have the same value:

colorPicker.on('change', function(color) {
  // whenever the color changes, force the hue value back to 100
  color.hue = 100;
});

Is it possible to increase the range 100 and above?

I'm not sure I understand this either

@niwanta
Copy link
Author

niwanta commented Dec 18, 2020

No worries, successfully implemented the color picker.
But some color pickers I've seen S and V values can be adjusted from 0-255.
Anyway 0-100 worked for me.

@jaames
Copy link
Owner

jaames commented Dec 18, 2020

But some color pickers I've seen S and V values can be adjusted from 0-255.

to convert x from 0-100 to 0-255 you can just do x * 2.55. I don't see why the color picker needs to do this

@marekburiak
Copy link

Instead of 255 steps you only have 100 so you're loosing precision. Obviously niwanta didn't mind.

@jaames jaames closed this as completed Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants