#38263 closed enhancement (fixed)
Color picker: add a hue-only mode
Reported by: | celloexpressions | Owned by: | mattwiebe |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | Customize | Keywords: | has-patch has-screenshots has-dev-note |
Focuses: | javascript | Cc: |
Description
Twenty Seventeen will make use of a hue picker for its custom colors. The WP color picker, and the underlying Iris color picker need to be updated to support a hue-only mode, and WP_Customize_Color_Control
would be updated to add a mode
parameter that can be set to hue
. When the hue mode is in use, the picker should return the numerical hue (0-359) instead of a hex color.
See https://github.com/WordPress/twentyseventeen/issues/116. @mattwiebe is potentially interested in implementing this.
Attachments (5)
Change History (29)
This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#4
@
8 years ago
Awesome @joshcummingsdesign! If you can get a hold of @mattwiebe, he may have insights here, but I'm thinking it's a matter of starting with Iris, then working your way out to wpColorPicker
and WP_Customize_Color_Control
to add the hue
mode option.
#5
@
8 years ago
- Owner set to celloexpressions
- Status changed from new to assigned
@celloexpressions Do you view this as necessary for 4.7, or just a nice to have? Is this something the CSS editor would take advantage of?
#6
@
8 years ago
- Owner changed from celloexpressions to mattwiebe
@jorbin this is needed for Twenty Seventeen's custom colors, actually. The current approach is in master
, but the UI is a range
slider, which isn't very intuitive. This will make it visual.
@mattwiebe let me and Helen know that he's now working on this in Iris, so I'm assigning to him for now.
#7
@
8 years ago
The above patch was with help from @joshcummingsdesign
I might not get to WP_Customize_Color_Control
today but it should be pretty straightforward.
In wpColorPicker
, you just do $(inputEl).wpColorPicker({ type: 'hue' })
to create a hue-only slider.
#8
@
8 years ago
- Keywords has-patch needs-testing added; needs-patch removed
Working patch there. Here's a video of it being used in Twenty Seventeen: https://cloudup.com/cxDNyN4ORsz
This ticket was mentioned in Slack in #core-customize by mattwiebe. View the logs.
8 years ago
#10
@
8 years ago
Nice work!
38263.3.diff makes use of the new slider in Twenty Seventeen. Testing, it works well for mouse and touch input, and can be used with a keyboard, although the slider needs a visual focus style. That's likely an issue with the existing color picker and can be addressed separately from this ticket.
See #38426 for making the Twenty Seventeen control contextual to the custom scheme.
#11
@
8 years ago
the slider needs a visual focus style
Yeah afaik there's a CSS reset in core that nukes focus stuff inherited from jQuery UI here.
This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.
8 years ago
#13
@
8 years ago
- Keywords commit added; needs-testing removed
- Owner changed from mattwiebe to westonruter
- Status changed from assigned to reviewing
This looks good to me.
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
8 years ago
#15
@
8 years ago
- Keywords needs-patch added; has-patch commit removed
@mattwiebe there's one thing missing I see. It's missing the two-way data binding between the hue control and the setting. The non-hue color picker will update the setting value when a different color is chosen, and likewise when the underlying setting is programmatically changed the color picker control selects the new color via this code:
this.setting.bind( function ( value ) { picker.val( value ); picker.wpColorPicker( 'color', value ); });
This part is missing from the hue control. Could you incorporate?
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
#19
@
8 years ago
- Keywords has-patch added; needs-patch removed
Two way binding and focus styles in that patch. Good to go as far as I can tell.
#22
@
8 years ago
I can cover this in the general 4.7 customizer API dev note, unless we think usage of Iris outside the customizer is wide enough to warrant a standalone post as well.
#24
@
4 years ago
- Keywords has-dev-note added; needs-dev-note removed
This was detailed in the following dev note: https://make.wordpress.org/core/2016/11/30/customizer-improvements-in-4-7/.
I'd be interested in working on this.