Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site editor background-color: #1e1e1e if theme.json styles.color not set and settings.color.palette missing base color in TT3 #54517

Open
glerner opened this issue Sep 15, 2023 · 1 comment
Labels
[Package] Style Engine /packages/style-engine [Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.

Comments

@glerner
Copy link

glerner commented Sep 15, 2023

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

    .edit-site .interface-interface-skeleton__content {
        background-color: #1e1e1e;
    }

but that color is also in (at least):

    body.js.site-editor-php {
        background: #1e1e1e;
    }
    .edit-site-visual-editor {
        background-color: #1e1e1e;
    }

With "defaultPalette": false, and base color bright green:

settings.color.palette {
  "color": "#00ff00",
  "name": "Base",
  "slug": "base"
},

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

"color": {
    "text": "#000000",
    "background": "blanchedalmond"
},

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

@glerner
Copy link
Author

glerner commented Sep 16, 2023

To Clarify:
TwentyTwentyThree (child) Should but does not fall back to:
.block-editor-iframe__body {
background-color: #fff;
}
falls back to
background: #1e1e1e; (and color: #000)
with these 3 conditions:
if defaultPalette is false, and
styles.color doesn’t have background-color set, and
settings.color.palette is missing a ‘base’ color

@glerner glerner changed the title Site editor background-color: #1e1e1e if theme.json settings.color.palette missing base color Site editor background-color: #1e1e1e if theme.json styles.color not set and settings.color.palette missing base color in TT3 Sep 16, 2023
@jordesign jordesign added [Type] Enhancement A suggestion for improvement. [Type] Developer Documentation Documentation for developers [Package] Style Engine /packages/style-engine labels Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Style Engine /packages/style-engine [Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants