From e65eaadfabd2500334d778223e910ae681243967 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 12 Nov 2024 15:28:16 +1100 Subject: [PATCH] Display classic theme color and gradient palettes --- packages/edit-site/src/classic-stylebook.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/classic-stylebook.js b/packages/edit-site/src/classic-stylebook.js index 8c62ce35b32a57..76c62515025fc1 100644 --- a/packages/edit-site/src/classic-stylebook.js +++ b/packages/edit-site/src/classic-stylebook.js @@ -22,6 +22,7 @@ import { useResizeObserver } from '@wordpress/compose'; import { store as blockEditorStore, BlockEditorProvider, + __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, } from '@wordpress/block-editor'; import { __ } from '@wordpress/i18n'; @@ -49,7 +50,19 @@ function ClassicStylebookLayout() { [] ); - const examples = getExamples(); + const { colors, gradients } = useMultipleOriginColorsAndGradients(); + // Exclude the default colors and gradients. + const themeColors = colors?.filter( ( color ) => color.slug === 'theme' ); + const themeGradients = gradients?.filter( + ( gradient ) => gradient.slug === 'theme' + ); + + const examples = getExamples( { + colors: themeColors, + gradients: themeGradients, + duotones: [], // Classic themes don't support duotone palettes. + } ); + // Dedupe the examples as they include all categories with repeat sections. const examplesForSinglePageUse = getExamplesForSinglePageUse( examples );