[wp-trac] [WordPress Trac] #55898: Make the notice- colors available for plugins/ themes that have an WordPress admin component
WordPress Trac
noreply at wordpress.org
Thu Jun 2 10:33:30 UTC 2022
#55898: Make the notice- colors available for plugins/ themes that have an
WordPress admin component
---------------------------------+--------------------------------------
Reporter: davidmosterd | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 6.0
Severity: minor | Keywords: 2nd-opinion dev-feedback
Focuses: css, administration |
---------------------------------+--------------------------------------
WordPress implements a color scheme for admin notices (and other cues)
which include success, warning, error, info, and a corresponding alt
variant.
tl;dr WordPress Admin could have CSS variables defining these colors for
developers to use.
When a theme or plugin has an admin component, these colors might be handy
to use if you want to implement cues that are not the default WordPress
notice. The CSS classes that are available cannot simply cover all the
possible cases where you want to implement one of these colors.
These colors are currently hardcoded in the various CSS files and grabbing
these colors requires you to either copy/paste them or have some regex to
extract them. I am not aware there is a more elegant way of doing it.
I would like to suggest that these colors would be made available as CSS
variables and in PHP with an action (or filter).
The reason why this would be good is to be forward-compatible when these
colors change again (this happened at least once in the past) and to
support the scenario when not everyone has updated to this version. And
prevent users to copy/ paste these colors and have them referenced, which
is just good practice in my opinion to give devs peace of mind this is not
something to keep track of in their plugin/ theme.
I would very much like to work on this myself, submitting this on
contributor day WCEU 2022 is no coincidence ;) But first I would like to
elicit some input from other WordPress contributors to validate this idea
and make sure it's not a duplicate or was decided on already.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55898>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list