-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Request: A few options for configurable design tweaks #19
Comments
There is #9 for the first thing. I would also like to have that myself. |
Hey! Thank you for the feature requests. :>
|
Went ahead and added a wheelLightness option to iro.ColorPicker. If you set this to I should note that this option will be documented as "unrecommended" though, I don't personally think this behaviour is exactly ideal from a design standpoint. ¯\_(ツ)_/¯ |
Thank you for offering us the option. I do think it is favourably for our use in the application. Since the default color is black, the first time you enter the color picker dialogue the entire wheel will be black. It is sort of less intuitive to just start clicking randomly on the black wheel I guess... But we'll see how it will be used and I will enable/disable this option based on that. |
As for request #3: I agree that pointing to a custom svg for the handles does make sense. And maybe one should be able to give a center offset per handle, just like Google Maps does for the the anchor point of an Icon: https://developers.google.com/maps/documentation/javascript/3.exp/reference#Icon |
Ah, I didn't think of that actually. You raise a very valid point there. :> Looks like custom SVG handles will be pretty easy to implement, The color picker parameters are starting to get a little messy though, I'm wondering if it's time to adopt some sort of multi-level param structure like this: var colorPicker = new iro.ColorPicker("#colorPicker", {
markers: {
url: "#markerShape",
origin: {x: 4, y: 4}
},
slider: {
height: 20,
margin: 24
},
wheel: {
lightness: false
}
}); Any thoughts? |
Yes I think something like that would be nice. And it might then also be nice to have a configurable slider (optional) for both elements separately: var colorPicker = new iro.ColorPicker("#colorPicker", {
slider: {
height: 20,
margin: 24,
marker: {
url: "#markerShape",
origin: {x: 4, y: 4}
}
},
wheel: {
lightness: false,
marker: {
url: "#markerShape",
origin: {x: 4, y: 4}
}
}
}); |
That would be a configurable marker per element. 'markers' could still be used optionally to configure both elements at once. |
Being able to configure markers per control element would be a good addition, I agree. When I was looking at implementing this earlier, I started to wonder if it would actually just be easer to allow developers to create each UI element directly if they wanted more options: var colorPicker = new iro.ColorPicker("#colorPicker", {
controls: [
iro.control.wheel({
...
}),
iro.control.slider({
...
}),
]
}); They're already created like this internally, and of course the "old" param format could still be kept around for users who just want to install the library and go. Maybe in the future, extra control types can be added and devs can decide which they want to use. |
Even better :) |
I created a fork with the slider vertical positioned.. :) |
@jaames Did you implement the discussion that was going on for creating custom handles (like svg) to override the already present marker? I have that requirement to change the marker and make it custom. |
@Harshit-pratiti It's on the todo list for version 4.0 (#30), but I haven't had the time to implement it yet. |
Custom SVG handles are now available in the iro.js v4 beta! The iro.ColorPicker constructor now supports Here's a basic example: <html>
<head>
<script src="https://unpkg.com/@jaames/iro@beta/dist/iro.js"></script>
</head>
<body>
<svg>
<!-- svg must be wrapped in a <defs> node -->
<defs>
<g id="#handle">
<rect x="0" y="0" width="10" height="10" fill="black"></rect>
</g>
</defs>
</svg>
<div id="color-picker-mount"></div>
<script>
var colorPicker = new iro.ColorPicker("#color-picker-mount", {
width: 360,
handleUrl: "#handle",
handleOrigin: {y: 0, x: 0},
});
</script>
</body>
</html> Custom handles per element (as discussed) will also be coming soon. Horizontal layout is further down the road because it's quite complicated, especially with plans for custom UI controls and optional extra sliders for transparency, etc. Sorry for taking so long to get around to this! ':) |
Custom handles are now available as of iro.js version 4.0.0! Check out the documentation here: https://iro.js.org/guide.html#custom-handles Horizontal layout will also be coming pretty soon, so I'm going to close this thread now. :) |
Hi,
Thanks for fixing the Safari/Angular bug I encountered. And since you asked, I do have a few little requests:
Well these are all 'would be nice', but I won't stop using your library anyway :)
The text was updated successfully, but these errors were encountered: