Fix: theme colors cannot override defaults#36811
Merged
Conversation
Member
Author
|
Marking as "needs dev note" to share that theme overriding theme colors is not expected and creates conflicts with the current direction for the UI color component (showing all palettes). |
Member
Author
|
Pushed a change to limit this to the |
d0491e7 to
1657ce6
Compare
| * Additionally, for some preset types, we also want to make sure the | ||
| * values they introduce don't conflict with default values. We do so | ||
| * by checking the incoming slugs for theme presets and compare them | ||
| * with the equivalent dfefault presets: if a slug is present as a default |
Member
|
Did another test after the updates and things seem to work well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36772
This PR removes the theme presets that have the same slug as a core preset of the same type. For example, the color theme presets can't have a
blackslug, which is already part of the color default presets.How to test
Global presets are filtered
theme.jsonupdate the value of the colors whose slug isblackandwhiteto a color that is easily inspectable for debugging purposes. For example:{ "slug": "black", "color": "#FF69B4", "name": "Black" }, { "slug": "white", "color": "#FF69B4", "name": "White" }global-styles-inline-cssembedded stylesheet.--wp--preset--color--blackwhose value is#000000and a single--wp--preset--color--whitewhose value is#FFFFFF(they come from the default palette).#FF69B4.Block-level presets are filtered
theme.jsonfile of the TT1-blocks, add the following palette undersettings.blocks.core/paragraph.color.palette:[ { "slug": "black", "color": "#FF69B4", "name": "Black" }, { "slug": "yellow", "color": "#EEEADD", "name": "Yellow" }, { "slug": "white", "color": "#FF69B4", "name": "White" } ]global-styles-inline-cssembedded stylesheet the expected result is that there's new CSS Custom Properties and classes scoped to the paragraph block: