Skip to content

Commit 936c2c8

Browse files
committed
The theme palette goes before the default one
1 parent cedf0e4 commit 936c2c8

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

packages/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
179179

180180
colorGradientSettings.colors = useMemo( () => {
181181
const result = [];
182+
if ( themeColors && themeColors.length ) {
183+
result.push( {
184+
name: __( 'Theme' ),
185+
colors: themeColors,
186+
} );
187+
}
182188
if (
183189
shouldDisplayDefaultColors &&
184190
defaultColors &&
@@ -189,12 +195,6 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
189195
colors: defaultColors,
190196
} );
191197
}
192-
if ( themeColors && themeColors.length ) {
193-
result.push( {
194-
name: __( 'Theme' ),
195-
colors: themeColors,
196-
} );
197-
}
198198
if ( customColors && customColors.length ) {
199199
result.push( {
200200
name: __( 'Custom' ),
@@ -212,6 +212,12 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
212212
);
213213
colorGradientSettings.gradients = useMemo( () => {
214214
const result = [];
215+
if ( themeGradients && themeGradients.length ) {
216+
result.push( {
217+
name: __( 'Theme' ),
218+
gradients: themeGradients,
219+
} );
220+
}
215221
if (
216222
shouldDisplayDefaultGradients &&
217223
defaultGradients &&
@@ -222,12 +228,6 @@ const PanelColorGradientSettingsMultipleSelect = ( props ) => {
222228
gradients: defaultGradients,
223229
} );
224230
}
225-
if ( themeGradients && themeGradients.length ) {
226-
result.push( {
227-
name: __( 'Theme' ),
228-
gradients: themeGradients,
229-
} );
230-
}
231231
if ( customGradients && customGradients.length ) {
232232
result.push( {
233233
name: __( 'Custom' ),

packages/edit-site/src/components/global-styles/hooks.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,18 @@ export function useColorsPerOrigin( name ) {
223223
const [ defaultColors ] = useSetting( 'color.palette.core', name );
224224
return useMemo( () => {
225225
const result = [];
226-
if ( defaultColors && defaultColors.length ) {
227-
result.push( {
228-
name: __( 'Default' ),
229-
colors: defaultColors,
230-
} );
231-
}
232226
if ( themeColors && themeColors.length ) {
233227
result.push( {
234228
name: __( 'Theme' ),
235229
colors: themeColors,
236230
} );
237231
}
232+
if ( defaultColors && defaultColors.length ) {
233+
result.push( {
234+
name: __( 'Default' ),
235+
colors: defaultColors,
236+
} );
237+
}
238238
if ( customColors && customColors.length ) {
239239
result.push( {
240240
name: __( 'Custom' ),
@@ -251,18 +251,18 @@ export function useGradientsPerOrigin( name ) {
251251
const [ defaultGradients ] = useSetting( 'color.gradients.core', name );
252252
return useMemo( () => {
253253
const result = [];
254-
if ( defaultGradients && defaultGradients.length ) {
255-
result.push( {
256-
name: __( 'Default' ),
257-
gradients: defaultGradients,
258-
} );
259-
}
260254
if ( themeGradients && themeGradients.length ) {
261255
result.push( {
262256
name: __( 'Theme' ),
263257
gradients: themeGradients,
264258
} );
265259
}
260+
if ( defaultGradients && defaultGradients.length ) {
261+
result.push( {
262+
name: __( 'Default' ),
263+
gradients: defaultGradients,
264+
} );
265+
}
266266
if ( customGradients && customGradients.length ) {
267267
result.push( {
268268
name: __( 'Custom' ),

0 commit comments

Comments
 (0)