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

Use styles.color.background and styles.color.text as variables #43627

Open
mikachan opened this issue Aug 26, 2022 · 3 comments
Open

Use styles.color.background and styles.color.text as variables #43627

mikachan opened this issue Aug 26, 2022 · 3 comments
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Comments

@mikachan
Copy link
Member

What problem does this address?

In theme.json, we can currently set styles.color.background and styles.color.text, but I believe these are only used by default to set background-color and color inline styles for the body and certain blocks, and they're not made available as variables.

What is your proposed solution?

It would be great if these two settings were also assigned to CSS variables that could then be referenced in many more places, such as block markup. Perhaps something like var(--wp--preset--styles--color--background) and var(--wp--preset--styles--color--text).

We can already do something similar within theme.json using ref:

":hover": {
	"color": {
		"background": {
			"ref": "styles.color.background"
		},
		"text": {
			"ref": "styles.color.text"
		}
	}
},
@mikachan mikachan added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Aug 26, 2022
@ghost
Copy link

ghost commented Aug 26, 2022

related to #39372

@mikachan
Copy link
Member Author

mikachan commented Sep 8, 2022

Also related to / duplicate of #39432.

@mikachan
Copy link
Member Author

Related: #49279

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 1, 2023
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] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants