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
Accepting null as default color #178
Comments
You need to specify a base / default color. Which color do you expect to be displayed if you pass an empty string? Pickr can't display no color (how should this even look like?) and an empty string is invalid. The expected behavior is what you see since pickr can't be initialized without providing a initial color value. |
Hi @simonwep Thanks for your reply, You answered only to my second question, as for the other two: In addition, I would expect to see the opacity and hue slider handles selected (the circle wrapping those pickers should be as when I single click on them) see ex. here: https://www.loom.com/share/e2e980ed12664ee2b9f81c7c7ec9aec2 Thanks! |
Hey @shilo-ey :) The problem is, you can't pass no value, so you can't expect to work with it without providing a very base value. Use If you don't pass a Regarding focus-border on the pickr-circles, I'll add these. Do you mind creating another issue for it since it's related to UI? |
Hi @simonwep Thanks. Regarding opening a new issue for the As for the
I don't mind the default being a mandatory setting, but I wish it would allow passing Just for clarification: Thanks for your efforts. |
Okay, If What you could do is using |
@shilo-ey Ok, let me try to explain it: These things (Marked with a red circle): Need to be somewhere, the cannot be invisible or whatever. By providing If you say So there are basically two colors:
|
And if I'd update it for accepting a |
And if you absolutly need to accept a null value, you can write a very small wrapper function for it: const createPickrInstance = options => {
const noDefault = !options.default;
const instance = new Pickr({
...options,
...(noDefault && {default: 'white'})
})
if (noDefault) {
const resetColor = () => {
instance.setColor(null);
instance.off('init', resetColor);
};
instance.on('init', resetColor);
}
return instance;
} As you can see you specify a color (white), if I'd accept |
Hi @simonwep Thank you for your patience and time. I think this discussion got off topic a bit. The empty result input issue after dragging the picker in the canvas only occurs when you don't specify an interaction color format (hexa, rgba...) For example: Thanks |
Good afternoon, @shilo-ey Neither of your fiddles work, Simon and I are unsure of what you're trying to get at here. Let me try and simplify this: You seem to be trying to use pickr in a use case that it was never intended for and I'm not exactly sure why. Pickr needs to be initialized with a default color, so do that. Use white for example as @simonwep has said multiple times. You can then use
Pickr must be initialized with a default value. Period. I understand that you would like to populate the colors with CSS, and that's something that we can help you figure out (I assume that it has something to do with the way Elementor is built). That being said, we are not going to rewrite a large section of well tested and reliable code to facilitate your one use case that honestly doesn't make much sense to me. Why can't you use one of the workarounds that @simonwep has suggested? I'm closing this issue. Have a nice day. |
What is the current behavior?
When initiating the Color Picker without a default color and without color conversion interactions (e.g
hex
,rgba
etc...), the following unwanted behavior occurs:pcr-result
) stays empty even after I assign a color in the color palettePlease provide the steps to reproduce and create a JSFiddle.
https://jsfiddle.net/4tvadnqp/
Bug reproduces in this link ^
What is the expected behavior?
result
input should change after I specify a color in the palette or in the swatchesThanks!
The text was updated successfully, but these errors were encountered: