spectrum icon indicating copy to clipboard operation
spectrum copied to clipboard

'addInitialToSelectionPalette' option

Open asimen1 opened this issue 10 years ago • 4 comments

Hi,

First of all thanks for the great plugin.

This pull request is for adding an option, which I named 'addInitialToSelectionPalette'. If you specify this value false, the initial color will not be automatically added to the selection palette. (default value is true so there will be no change in current behavior)

This change expands the options and making the plugin more customizable.

The problem I encountered for which I required to add this option: I use multiple color pickers in multiple views which are handled by a layout system that handles removing views from the DOM and rerendering them when necessary. I noticed an issue that every time a spectrum color picker is rendered to the DOM, it's initial color is automatically added to the selection palette even if it was not interacted with / shown. This cause the selection palette to show colors which were not the recently selected ones. By adding this option, the initial color was not added on initialization of the color picker.

Take note, this also means that it is possible for the color picker to show without any color marked as selected in the selection palette (since this color is not automatically added). This behavior seems fine to me and as desired.

Thanks, Asaf.

asimen1 avatar Apr 21 '15 11:04 asimen1

Hello, this seems like a good change. Can you please add a test in the options section of the test script for this? https://github.com/bgrins/spectrum/blob/c2c09b3165ffa96ec3f4fab1cee447fd94c41068/test/tests.js#L284

bgrins avatar Apr 25 '15 19:04 bgrins

Hey, I've added the test for it, passed successfully for me. :100:

Thanks.

asimen1 avatar Apr 26 '15 09:04 asimen1

Hi, Any estimations on when this will be added?

asimen1 avatar May 19 '15 11:05 asimen1

I know this PR is nearly 7 years old at this point and the last update to this repo was 2 years ago butttt what are the chances of this getting merged in if the conflicts get resolved? I have the exact same situation and before I fork the repo and run with my own version I thought I would ask if its at all likely. Thanks! Cheers.

decherneyge avatar Jan 21 '22 17:01 decherneyge