Skip to content

Custom Colors: fix theme background color ignoring 'Use theme styles' toggle#49060

Open
msilbers wants to merge 1 commit into
Automattic:trunkfrom
msilbers:fix/edi-504-wpcomsh-theme-bg-color-editor-toggle
Open

Custom Colors: fix theme background color ignoring 'Use theme styles' toggle#49060
msilbers wants to merge 1 commit into
Automattic:trunkfrom
msilbers:fix/edi-504-wpcomsh-theme-bg-color-editor-toggle

Conversation

@msilbers
Copy link
Copy Markdown

@msilbers msilbers commented May 21, 2026

What

Fixes EDI-504 — theme background color displays in the editor when "Use theme styles" is disabled on classic themes (Atomic/WoA sites).

Companion PR to wpcom #218901 which fixes the same issue on Simple sites.

Why

Classic themes (Twenty Sixteen, Twenty Twenty, etc.) with custom background colors inject those colors into the block editor via wp_add_inline_style(), which bypasses Gutenberg's style management. The "Use theme styles" toggle has no effect on these injected styles.

How

Switches the CSS injection from enqueue_block_editor_assets + wp_add_inline_style() to the block_editor_settings_all filter with __unstableType => 'theme', so Gutenberg treats them as theme styles and the toggle controls them.

The existing print_block_editor_css() method is left in place as it may be called from other contexts or subclasses.

Testing

  • On an Atomic site with Twenty Sixteen + custom background color:
    • "Use theme styles" ON → custom background shows in editor
    • "Use theme styles" OFF → custom background removed from editor
  • Repeat with Twenty Twenty
  • Verify published posts display correctly in both states
  • Verify no regressions in editor color rendering for other classic themes

Note: Verified via code review and parity with the wpcom Simple site fix. Reviewer input on live-site behavior requested.

Note: The Linear issue was auto-marked "In Progress" when the wpcom PR opened. This is review-ready, not actively worked by an engineer.

… toggle

Classic themes (Twenty Sixteen, Twenty Twenty, etc.) with custom background
colors inject those colors into the block editor via wp_add_inline_style(),
which bypasses Gutenberg's style management — the "Use theme styles" toggle
has no effect on Atomic/WoA sites.

Switch the CSS injection from enqueue_block_editor_assets + wp_add_inline_style()
to the block_editor_settings_all filter with __unstableType => 'theme', so
Gutenberg treats them as theme styles and the toggle controls them.

Companion to https://github.a8c.com/Automattic/wpcom/pull/218901 (Simple sites).

Fixes https://linear.app/a8c/issue/EDI-504
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • 🔴 Add testing instructions.
  • 🔴 Specify whether this PR includes any changes to data or privacy.
  • 🔴 Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


🔴 Action required: Please include detailed testing steps, explaining how to test your change, like so:

## Testing instructions:

* Go to '..'
*

🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so:

## Does this pull request change what data or activity we track or use?

My PR adds *x* and *y*.

🔴 Action required: Please add missing changelog entries for the following projects: projects/plugins/wpcomsh

Use the Jetpack CLI tool to generate changelog entries by running the following command: jetpack changelog add.
Guidelines: /docs/writing-a-good-changelog-entry.md



Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. OSS Citizen This Pull Request was opened by an Open Source contributor. labels May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OSS Citizen This Pull Request was opened by an Open Source contributor. [Plugin] Wpcomsh [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant