Skip to content

Gradient background set in theme.json can not be replaced with solid color #42105

@carolinan

Description

@carolinan

Description

If a theme sets a default gradient body background in theme.json, it is not possible to replace the gradient with a solid color in the Styles settings in the site editor.

The resulting CSS is:

body {
    background: var(--wp--preset--gradient--pale-ocean);
    background-color: var(--wp--preset--color--black);

and the background is used over the background-color

Step-by-step reproduction instructions

Activate a full site editing theme, for example Twenty Twenty-Two, -or use https://wordpress.org/themes/miniblock-ooak/ which already has a gradient background.

Add the gradient body background to styles.color in theme.json:

	"styles": {
		"color": {
			"gradient": "var(--wp--preset--gradient--pale-ocean)",
		},
  • Open the Site Editor.
  • Next, open the styles sidebar and select colors, elements, background.
  • In the color panel, switch tab to the solid color, and select a color.
  • Notice that the body background color does not change.
  • Save the styles and view the front of the website, confirm that it does not change on the front, either.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 5.9.3, 6.0 with and without Gutenberg active.
Windows 10
Chrome

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions