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

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

Open
carolinan opened this issue Jul 2, 2022 · 3 comments
Open
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

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

@carolinan carolinan added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended labels Jul 2, 2022
@carolinan carolinan changed the title Gradient body background set in theme.json can not be replaced with solid color Gradient background set in theme.json can not be replaced with solid color Jul 22, 2022
@carolinan
Copy link
Contributor Author

carolinan commented Jul 22, 2022

As mentioned in the duplicate issue, this does not only happen with the body background but also other backgrounds.

@carolinan
Copy link
Contributor Author

@carolinan carolinan added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Aug 11, 2022
@gefgu
Copy link

gefgu commented Aug 18, 2022

Hi! Can I work on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants