Skip to content

Commit

Permalink
Make duotones work if declared.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Dec 6, 2024
1 parent 2c5a804 commit 4193851
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/edit-site/src/components/style-book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,22 @@ export const StyleBookPreview = ( {

const [ resizeObserver, sizes ] = useResizeObserver();
const { colors, gradients } = useMultipleOriginColorsAndGradients();

const [ duotones ] = useSettings( 'color.duotone.theme' );

const themeDuotone = duotones?.length
? [
{
name: _x(
'Theme',
'Indicates these duotone filters come from the theme.'
),
slug: 'theme',
duotones,
},
]
: null;

// Exclude the default colors and gradients.
const themeColors = colors?.filter( ( color ) => color.slug === 'theme' );
const themeGradients = gradients?.filter(
Expand All @@ -368,7 +384,7 @@ export const StyleBookPreview = ( {
const examples = getExamples( {
colors: themeColors,
gradients: themeGradients,
duotones: [], // Classic themes don't support duotone palettes.
duotones: themeDuotone || [],
} );
const examplesForSinglePageUse = getExamplesForSinglePageUse( examples );

Expand Down

0 comments on commit 4193851

Please sign in to comment.