-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Highlight color swatch if it match current selected color #135
Comments
|
Yes, it would be a great feature :) I noticed the clear and cancel buttons use same class, can these have different classes in case you want to styling these different. |
Of course :) |
@simonwep isn't it possible to set color right after creating an Pickr instance?
It does however work if using |
No, the problem is pickr can only be initialized if it's rendered to the DOM. Otherwise the sliders would totally get messed up since pickr wouldn't have any width or height (There where already like 3 issues because of this). But you can use the Another option would be to wrap pickr into a Promise and resolve these with the pickr instance e.g. // Wrap pickr
const createPickrAsync = options =>
new Promise(resolve => Pickr.create(options).on('init', resolve));
createPickrAsync({...myOptions}).then(pickr =>{
// Do smth
}) Edit: Otherwise there wouldn't be a |
Okay, if was able to set to default value fron It the docs |
Yeah, the options are just examples. I'll update the readme |
Added in c54c925, not sure how I'd visually show the difference between focusing and detecting the target-swatch. Any ideas? |
@simonwep do we need to classes |
Currently not, therefore I just added |
Why? Both buttons need same styling just use the following instead.
I don't see why the cancel button need both classes and it is more diffucult to add specific styles on clear button in your own theme. |
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Selecting a color from the color swatches updates the input field color code and preview and highlight the selected color swatch, but the color swatch is not selected when re-open the color picker
If the current behavior is a bug, please provide the steps to reproduce and create a JSFiddle.
Can be reproduced here https://jsfiddle.net/Simonwep/qx2Lod6r/ and here https://simonwep.github.io/pickr/
Select a color from the color swatches. The color swatch is marked as selected with a border. When clicking save and re-open the color picker afterwards the selection is gone.
What is the expected behavior?
The color swatch should stay selected after re-open the color picker.
It would also be great if the color swatch was highlighted when manually enter a color code in the input field which match a color code of one of the color swatches, e.g.
#3F51B5CC
.It seems the selection at the moment only is a focus state. If the selected color swatch has a class, it could e.g. have an "checkmark" inside the box to mark is as selected? (without using a library like font awesome it could use css, e.g. styled via
:before
pseudo element background image using svg: and https://iconmonstr.com/check-mark-1-svg/ so changing focus via tab still makes it clear which has focus and which is selected.Your environment:
The text was updated successfully, but these errors were encountered: