Site editor background-color: #1e1e1e if theme.json styles.color not set and settings.color.palette missing base color in TT3 #54517
Labels
[Package] Style Engine
/packages/style-engine
[Type] Developer Documentation
Documentation for developers
[Type] Enhancement
A suggestion for improvement.
Description
If theme.json defaultPalette is false, and settings.color.palette doesn't have slug 'base', the Site Editor displays with background-color: #1e1e1e; and text color black, illegible.
Suggestion: Add error-checking, so :
if settings.color.palette is missing a 'base' color, and
defaultPalette is false, and
styles.color doesn't have both a color and background-color set, then
set styles.color so the site editor is readable.
For a light theme, black on blanchedalmond is readable but designers would wonder "where did that color come from".
Suggestion: Add documentation to https://fullsiteediting.com/lessons/theme-json-color-options/ giving the impacts of not having palette color 'base' and not having styles.color set.
Perhaps "Your Site Editor background color and text color are set from the settings.color.palette 'base' and 'contrast' colors. If you don't define them, the Editor colors are taken from styles.color (so you should define one or both of these text and background colors)."
Step-by-step reproduction instructions
TwentyTwentyThree child theme, using TT3 theme.json
Edit theme.json,
settings.color, "defaultPalette": false
settings.color.palette rename slug 'base' to 'wrong-base'
Browser Inspector shows background-color: var(--wp--preset--color--base) not defined.
Edit Site has background #1e1e1e with color #000000, illegible.
Edit Site background is #1e1e1e inherited from
With "defaultPalette": false, and base color bright green:
Most of the site's pages are bright green.
Edit Post, bright green,
Edit Site, bright green.
Theme.json edit slug from "base" to "wrong-base"
set styles.color
And the Site Editor is blanchedalmond
Perhaps related to Issue #40183 Don't load core colors in editor when theme.json is used
Screenshots, screen recording, code snippet
No response
Environment info
WP 6.3.1, Gutenberg plugin not installed.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: