#27469 closed enhancement (invalid)
Color picker palette can't be customized
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.5 |
Component: | Customize | Keywords: | |
Focuses: | javascript | Cc: |
Description
Hello.
Under the color picker we have a palette with up to 6 colors (or 8?). Regarding iris, the option "palettes" can be a boolean, or, if we want custom colors, it must be an array.
In wp-admin/js/color-picker.js L27 we have $.extend( self.options, el.data() );
.
The problem is:
- if we pass a string, iris won't use it.
- if we pass an array, $.extend() will change it into a string.
My solution is allowing us to pass a comma separated list of colors and split()
. See the diff file.
Side note: add the width to the available options could be useful sometimes, I guess.
Attachments (1)
Change History (4)
#1
@
11 years ago
- Resolution set to invalid
- Status changed from new to closed
This is actually unnecessary, what's there as-is works fine. jQuery's .data() support for HTML5 values will attempt to JSON.parse
any data-*
attributes, but they need to be in a format that works for JSON.parse, where only double quotes are parse-able. This won't work:
<input data-palettes="['#fff', '#000']">
but this will:
<input data-palettes='["#fff", "#000"]'>
Anyway, apologies for getting to this slowly.
If you have a use-case for width, please open another ticket for that. :)
Process the palettes