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

Making css class names for colors configurable #33675

Closed
mkkeck opened this issue Jul 25, 2021 · 3 comments
Closed

Making css class names for colors configurable #33675

mkkeck opened this issue Jul 25, 2021 · 3 comments
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Status] Not Implemented Issue/PR we will (likely) not implement.

Comments

@mkkeck
Copy link

mkkeck commented Jul 25, 2021

What problem does this address?

I am developing a theme based on a specific css framework, which includes predefined class names for colors. For example it uses has-color, to define if element has a color and with has-color-success to define a greenish text. The same class is used for buttons, means the button has only the class has-color has-color-green, which results in a button with greenish background and white text. With an extra class on buttons like btn-outline the colors are reversed.
How can I change the output for class names in block editor, replacing the for example has-green-background-color, has-green-color, etc.?

What is your proposed solution?

Make it available to modify the block class names for colors and make it available to disable background-colors or text-colors for specific blocks.

has-color has-color-name and has-bgcolor has-bgcolor-name would be also more semantic and clearer than has-color has-name-color and has-background-color has-name-background-color.
Also it makes class selection in JS and CSS much easier with for example node[class^='has-color-']

@talldan talldan added the [Status] Not Implemented Issue/PR we will (likely) not implement. label Jul 26, 2021
@talldan
Copy link
Contributor

talldan commented Jul 26, 2021

@mkkeck I don't think that's really feasible, as it'd mean re-writing the whole of WordPress core's block styles to fit the modified naming convention. This is a very niche use-case, it'd be a lot of work just to support one theme that wants a different naming convention.

@talldan talldan closed this as completed Jul 26, 2021
@talldan talldan added the CSS Styling Related to editor and front end styles, CSS-specific issues. label Jul 26, 2021
@mkkeck
Copy link
Author

mkkeck commented Jul 26, 2021

I don't mean rewrite the whole core block styles. I suggested an option to make it available to filter and/or configure to replace the default block color class names.
Is it really impossible?
And of course, many css frameworks use a different color class naming convention, instead Wordpress does, where the color name is the last part, ie property-to-set-color.

@talldan
Copy link
Contributor

talldan commented Jul 27, 2021

@mkkeck Nothing is impossible, but feasibility isn't the same as possibility.

Feature requests have to be considered on a number of criteria like the following:

  • Does it provide value to the majority of WordPress users?
  • How much effort is it to develop and maintain?
  • Is it a feature that can comfortably be made backwards compatible and compatible with plugins? (but also for this specific feature, things like user defined CSS)

So that's the reason for closing the issue.

If there's a strong reason for this kind of feature in the future the possibility is always there to change direction, but right now it doesn't seem like a good fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Status] Not Implemented Issue/PR we will (likely) not implement.
Projects
None yet
Development

No branches or pull requests

2 participants