-
Notifications
You must be signed in to change notification settings - Fork 584
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
Alpha handling & formatting #182
Comments
I'm having a bit of trouble understanding exactly what functionality you are wanting. So you are setting the value to be something like rgba(255, 0, 0, .5), but with showAlpha as false and preferredFormat of hex? Currently, that causes the output to turn into a hex after a change, doesn't it? Here is a test case set up how I think you are explaining, can you modify it if needed to explain the issue you are seeing? http://jsfiddle.net/bgrins/UzPRF/ |
Mmm, sorry, looks like the behavior I'm describing has changed with f8301b7 👎 This change makes it harder to use Is there any hope of having a mode (showAlpha = false, color's alpha < 1) that maintains the alpha but does not output it, neither in the input's value nor in the 'showInput' section? |
Also, the colors added to the palette are affected by the opacity. We use the showAlpha = false mode to make it a RGB selector, and ideally only the swatch would show the alpha and the colors in the palette would be solid. |
This could probably be an option. I believe that it was introduced because otherwise you could get stuck with an alpha value that you didn't want. I'm thinking a basic workaround (that could be rolled into an option) is to remove the
If this is sufficient, then we should be able to either provide a new option, or somehow overload the showAlpha option to allow this behavior. |
Right, this indeed bypasses the code of f8301b7 and css hides the alpha controller, so this has the right effect. |
OK, I've pushed this up as an option on a branch here: https://github.com/bgrins/spectrum/blob/revertAlpha/spectrum.js. I don't really like the name
|
I agree that it's really 3 options for In any case, the choice is yours. Thanks for considering this 😸 |
We use
spectrum
to select colours but we deal ourselves with the alpha selection with a separate control.It works well, and it's nice that
spectrum
handles this very well with thesetAlpha
method andshowAlpha == false
option.I'm not sure why the
preferredFormat
of 'hex' is overridden in theshowInput
section when alpha < 1 to insure the alpha is shown (not really what we'd like, to be honest), but the output itself to the input is not overridden (and thus does not contain the alpha), which is exactly what we want.Is it a "feature" we can rely on? Would it be appropriate (at least if
showAlpha == false
) to not do the override?Ideally, typing a color's hex code would also change the colour but not the alpha (again, at least if
showAlpha == false
).The text was updated successfully, but these errors were encountered: