Skip to content

Global Styles: Add light and dark palette controls - #80805

Draft
MaggieCabrera wants to merge 6 commits into
try/dark-mode-duotonefrom
codex/color-scheme-palette-ui
Draft

Global Styles: Add light and dark palette controls#80805
MaggieCabrera wants to merge 6 commits into
try/dark-mode-duotonefrom
codex/color-scheme-palette-ui

Conversation

@MaggieCabrera

@MaggieCabrera MaggieCabrera commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What

Adds scheme-specific color, gradient, and duotone controls to Global Styles. Light or dark sections appear only when the active theme defines them and use sun or moon labels.

Stacked on #80746 and #80698.

Testing

Use either fixture from WordPress/community-themes#266 with this full PR stack.

  1. Activate dark-theme.
  2. Open Appearance → Editor → Styles → Colors → Edit palette.
  3. Confirm Light palette, Light gradients, and Light duotone appear in their respective tabs.
  4. Edit a scheme value, save, and confirm the front end uses it when Paper Morning is selected.
  5. Repeat with light-theme and confirm the sections are labeled for the dark scheme.

Screenshots

Controls

ColorGradientDuotone
Dark palette controls in Global Styles Dark gradient controls in Global Styles Dark duotone controls in Global Styles

Style indicators

Dark scheme availableLight scheme available
Style preview with a moon icon indicating a dark color scheme is available Style preview with a sun icon indicating a light color scheme is available

@github-actions

Copy link
Copy Markdown

Size Change: +4.42 kB (+0.06%)

Total Size: 7.76 MB

📦 View Changed
Filename Size Change
build/modules/lazy-editor/index.min.js 15.2 kB +467 B (+3.16%)
build/scripts/block-editor/index.min.js 428 kB +20 B (0%)
build/scripts/components/index.min.js 273 kB +217 B (+0.08%)
build/scripts/edit-post/index.min.js 52 kB +1 B (0%)
build/scripts/edit-site/index.min.js 306 kB +1.37 kB (+0.45%)
build/scripts/editor/index.min.js 500 kB +1.47 kB (+0.3%)
build/scripts/format-library/index.min.js 29.6 kB -9 B (-0.03%)
build/styles/edit-site/style-rtl.css 21.5 kB +110 B (+0.51%)
build/styles/edit-site/style-rtl.min.css 17.6 kB +101 B (+0.58%)
build/styles/edit-site/style.css 21.5 kB +111 B (+0.52%)
build/styles/edit-site/style.min.css 17.6 kB +104 B (+0.59%)
build/styles/editor/style-rtl.css 31.1 kB +108 B (+0.35%)
build/styles/editor/style-rtl.min.css 26.5 kB +121 B (+0.46%)
build/styles/editor/style.css 31.2 kB +110 B (+0.35%)
build/styles/editor/style.min.css 26.5 kB +122 B (+0.46%)

compressed-size-action

@github-actions

Copy link
Copy Markdown

Flaky tests detected in 9a0edca.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30388846880
📝 Reported issues:

@MaggieCabrera
MaggieCabrera requested a review from Copilot July 28, 2026 20:16
@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Components, [Package] Icons.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds scheme-aware (light/dark) Global Styles preset editing and preview affordances, building on the theme.json color-scheme data model in Global Styles Engine and extending the palette UI to support scheme variations.

Changes:

  • Add sun/moon icons and a preview badge indicator for available light/dark scheme presets.
  • Extend Global Styles UI palette editing to expose scheme-specific palette/gradient/duotone variations (including a new Duotone tab/panel).
  • Extend Global Styles Engine rendering/types to support scheme preset overrides (including duotone filter variants and scheme-scoped CSS custom properties).

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/icons/src/manifest.php Registers new sun / moon icons.
packages/icons/src/manifest.json Adds sun / moon icon metadata for JS consumers.
packages/icons/src/library/sun.svg New sun SVG asset used for “light scheme” UI.
packages/icons/src/library/moon.svg New moon SVG asset used for “dark scheme” UI.
packages/global-styles-ui/src/test/scheme-preview-indicator.spec.tsx Tests indicator rendering + scheme preset detection.
packages/global-styles-ui/src/test/duotone-palette-panel.spec.tsx Tests scheme duotone panel rendering behavior.
packages/global-styles-ui/src/test/color-scheme-palette.spec.ts Tests scheme preset normalization helpers.
packages/global-styles-ui/src/style.scss Styles for scheme indicators and duotone panel layout.
packages/global-styles-ui/src/screen-color-palette.tsx Adds Duotone tab and panel.
packages/global-styles-ui/src/scheme-preview-indicator.tsx Renders scheme availability badges in previews.
packages/global-styles-ui/src/preview-styles.tsx Mounts the scheme indicator into the preview wrapper.
packages/global-styles-ui/src/gradients-palette-panel.tsx Adds scheme gradient variations via paletteVariations.
packages/global-styles-ui/src/duotone-palette-panel.tsx New UI panel for theme + scheme duotone palettes.
packages/global-styles-ui/src/color-scheme-palette.tsx New helpers for flattening and naming scheme presets + scheme icons.
packages/global-styles-ui/src/color-palette-panel.tsx Adds scheme color variations via paletteVariations.
packages/global-styles-engine/src/types.ts Introduces scheme preset types and wires color.light / color.dark into settings types.
packages/global-styles-engine/src/test/render.test.ts Tests scheme variable output + scheme duotone filter output.
packages/global-styles-engine/src/settings/get-setting.ts Includes color.light / color.dark in enumerated settings map output.
packages/global-styles-engine/src/core/render.tsx Emits scheme-scoped preset variables and scheme duotone filters.
packages/components/src/palette-edit/types.ts Adds paletteIcon and typed paletteVariations support.
packages/components/src/palette-edit/test/index.tsx Tests palette icon rendering and variation editing/reset behavior.
packages/components/src/palette-edit/styles.ts Adds layout styles for headings with icons + variation section wrapper.
packages/components/src/palette-edit/index.tsx Implements variation rendering, combined reset, and menu gating updates.

Comment on lines +54 to +62
export type ColorSchemePreset< T extends BasePreset > = Omit< T, 'name' > & {
name?: string;
};

export interface ColorSchemeSettings {
palette?: ColorSchemePreset< Color >[];
gradients?: ColorSchemePreset< Gradient >[];
duotone?: ColorSchemePreset< Duotone >[];
}
Comment on lines 398 to +417
@@ -399,6 +412,12 @@ export function PaletteEdit( {
! elements[ editingElement ].slug;
const elementsLength = elements.length;
const hasElements = elementsLength > 0;
const hasVariations = variations.some(
( variation ) => variation.elements.length > 0
);
Comment on lines 703 to 705
{ ! hasElements && emptyMessage && (
<PaletteEditContents>{ emptyMessage }</PaletteEditContents>
) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] Icons /packages/icons

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants