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

Theme colors can override default colors #36772

Closed
oandregal opened this issue Nov 23, 2021 · 5 comments · Fixed by #36811
Closed

Theme colors can override default colors #36772

oandregal opened this issue Nov 23, 2021 · 5 comments · Fixed by #36811
Assignees
Labels
[Feature] Colors Color management [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@oandregal
Copy link
Member

In testing #36770 there's an issue with the theme palette that may override the default palette, creating weird interactions in the editor.

How to reproduce:

  • Use the empty theme and add a color with the same slug as one in the default palette. For example (note that I use red as the color value for debugging purposes, the important bit is that I'm using the black slug):
{
	"version": 2,
	"settings": {
		"color": {
			"palette": [
				{
					"name": "Black",
					"slug": "black",
					"color": "red"
				}
			]
		},
  • Go to the post editor and add a paragraph.
  • Select the black color from the default palette.

Notice that the text color becomes red instead.

Future

In the future, we may consider adding an explicit API for themes to override colors in the default palette.

@oandregal oandregal added [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Bug An existing feature does not function as intended labels Nov 23, 2021
@oandregal oandregal added this to 📥 To do in WordPress 5.9 Must-Haves via automation Nov 23, 2021
@oandregal
Copy link
Member Author

We can also look at simplifying the merge algorithm, as presets no longer are merged but live under a different key (default, theme, or custom).

@oandregal oandregal self-assigned this Nov 23, 2021
@skorasaurus skorasaurus added the [Feature] Colors Color management label Nov 23, 2021
@carolinan
Copy link
Contributor

Duplicate of #36360?

@oandregal
Copy link
Member Author

Thanks for sharing, Carolina. That's the same sort of problem (colors from different palettes having the same slug) but the conflict, in that case, comes from user colors. The fix for that was different and part of #36674

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 24, 2021
@chthonic-ds
Copy link
Contributor

chthonic-ds commented Nov 24, 2021

Is it possible to continue allowing theme colours to override the default ones if core palettes are disabled by the theme?

My use-case: I have a theme with "black" and "white" values that are not pure black and white. I originally set these up with custom colour names but later switched to overriding the default --wp--preset--color--black and --wp--preset--color--white properties. This allows the theme's patterns to have those colours set as defaults, while also allowing those patterns to persist across a theme change by inheriting the default black and white properties.

@oandregal
Copy link
Member Author

Hi @chthonic-ds thanks for raising that issue. I've created a draft PR to address it at #37008

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Colors Color management [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants