Make WordPress Core

Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#55898 closed enhancement (duplicate)

Make the notice- colors available for plugins/ themes that have an WordPress admin component

Reported by: davidmosterd's profile davidmosterd Owned by:
Milestone: Priority: normal
Severity: minor Version: 6.0
Component: Administration Keywords:
Focuses: css, administration Cc:

Description

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.

Change History (4)

#2 follow-up: @sabernhardt
21 months ago

  • Keywords 2nd-opinion dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

The project is tracked on #49930, if you would like to add comments there and/or join in the effort.

#3 in reply to: ↑ 2 @davidmosterd
21 months ago

Replying to sabernhardt:

The project is tracked on #49930, if you would like to add comments there and/or join in the effort.

It would make the scope bigger for #49930, as this would be primarily about the wp-admin colors that do not change when a theme changes. It's basically about exposing them to plugin/ theme developers so they can refer to them for their own notices/ cues.

Do you think we can incorporate it, or better to keep it separate?

#4 @sabernhardt
21 months ago

I think reusability by plugin developers should be part of the discussion now, even if it makes more sense as a later phase of the project. (If split into phases, we could reopen this ticket specifically for that phase.)

Note: See TracTickets for help on using tickets.