@@ -12,8 +12,9 @@ import {
1212 InspectorSubHeader ,
1313 ColorPaletteControl ,
1414 AdvancedTextControl ,
15+ AdvancedToggleControl ,
1516 ColorSchemePreview ,
16- PresetColorSchemesPicker ,
17+ ColorSchemePresetPicker ,
1718 DEFAULT_COLOR_SCHEME_COLORS ,
1819} from '~stackable/components'
1920import { useBlockHoverState } from '~stackable/hooks'
@@ -152,6 +153,17 @@ const ColorSchemePicker = props => {
152153 updateColorSchemes ( currentItem )
153154 }
154155
156+ const onChangeShowInPicker = value => {
157+ if ( ! itemInEdit ) {
158+ return
159+ }
160+ const currentItem = cloneDeep ( itemInEdit )
161+ currentItem . showInPicker = value === '' ? false : value
162+ setItemInEdit ( currentItem )
163+
164+ updateColorSchemes ( currentItem )
165+ }
166+
155167 // Update the current color scheme when a preset is selected.
156168 const onPresetClick = colors => {
157169 if ( ! itemInEdit ) {
@@ -192,6 +204,7 @@ const ColorSchemePicker = props => {
192204 }
193205 }
194206
207+ // Duplicate the color scheme being edited
195208 const onDuplicate = item => {
196209 // eslint-disable-next-line no-alert
197210 const confirmDuplicate = window . confirm ( __ ( 'Do you want to duplicate this color scheme?' , i18n ) )
@@ -286,13 +299,19 @@ const ColorSchemePicker = props => {
286299 } }
287300 />
288301
289- < PresetColorSchemesPicker
290- label = { __ ( 'Preset Color Schemes ' , i18n ) }
302+ < ColorSchemePresetPicker
303+ label = { __ ( 'Color Scheme Presets ' , i18n ) }
291304 presets = { PRESETS }
292305 onPresetClick = { onPresetClick }
293306 />
294307 </ div >
295308
309+ < AdvancedToggleControl
310+ label = { __ ( 'Show color scheme colors in color picker' , i18n ) }
311+ checked = { itemInEdit ?. showInPicker }
312+ onChange = { value => onChangeShowInPicker ( value ) }
313+ defaultValue = { itemInEdit ?. key ?. startsWith ( 'scheme-default' ) }
314+ />
296315 { COLOR_SETTINGS . map ( ( settings , index ) => (
297316 < ColorPaletteControl
298317 key = { index }
0 commit comments