-
Notifications
You must be signed in to change notification settings - Fork 43
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
Standardize theme editor color names #75
Comments
Related Gutenberg ticket: WordPress/gutenberg#7553 |
See themehybrid/mythic#75 for details
After some time with this in a real-world project, I'm really not seeing it as solving many problems. One theme's blue color may be dark where another theme's blue color may be light, for example. That may very well cause more problems. I've taken two approaches to handling this: Default background and text colors: I've assigned a default background for the This way, even if it's not the user's chosen colors, the paragraph (or whatever block) is still "highlighted" in some way. It's not perfect, but it should cover a lot of ground. Color spectrum: I've also followed Tailwind's color naming system to create 10 colors with 7 shades + black and white. I don't necessarily put all 72 of those colors in the editor palette. I just use the ones that make sense for the project.
On the theme- and custom- prefixesI don't agree that we need the First, these are theme colors by default. That's why they're added via the It's only when something like a plugin decides to do something different and add in colors does prefixing need to happen. And, the standard for prefixing with something like My second gripe with this is the prefix adds more weight to final CSS files. I already wish core would've simply used With a few definitions, this isn't a big deal. With many colors, it starts adding up. And, it adds up even more when you start having to do things with Side note to this: I find the argument of Gzipping and minification irrelevant here. Every byte and every user matter. |
The As for whether the overall approach solves problems, I disagree with your conclusion. Having watched users apply custom colors to their blocks only to see them vanish mysteriously when they switch themes is a clear indication the core solution creates unexpected behavior. By establishing a naming convention around primary, secondary, key, etc colors, theme developers can create more extended color themes for things like dark/light color palettes and style variations, and enable natural transitions when users swap themes. The problem as I see it isn't as much with the actual colors but rather that Gutenberg insists on calling them by their names rather than their function. Thus the In my opinion. |
I do want to note that I'm very much in favor of standardizing on a functional color naming system, which is the primary reason this ticket is still open. |
Let's put our heads together and come up with a joint proposal for core! |
If there's any kind of standardization, I think it would be important to note if the color is dark or light for accessibility reasons. |
WP Rig is creating a standardized theme editor color palette naming scheme. I think we should follow suit. See: https://github.com/wprig/wprig/blob/v2.0/inc/Editor/Component.php#L47-L114
The purpose of this is to create a naming scheme that has forward-compatibility between themes. It wouldn't address all compat problems, but it would help eliminate many of them and allow users to continue seeing their color choices reflected when switching themes if enough theme authors followed suit.
Primary and secondary color:
theme-primary
theme-secondary
Setting basic colors:
theme-black
theme-white
theme-blue
theme-green
theme-yellow
theme-gray
theme-red
Custom colors:
custom-colorname
CC: @mor10 in case he has any additional info/ideas related to this not covered.
The text was updated successfully, but these errors were encountered: