Make WordPress Core

Opened 19 months ago

Closed 3 months ago

#57167 closed enhancement (wontfix)

Twenty Twenty-Three: Replace base and contrast color names with ref values

Reported by: mikachan's profile mikachan Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: 2nd-opinion has-patch
Focuses: Cc:


There have been previous discussions around the use of "base" and "contrast" as color names in the Twenty Twenty-Three color palette, here:

I'd like to propose another idea that may help solve the naming issues, especially around these two colors. We could define these two colors in styles.color.background and styles.color.text instead of defining them separately in the color palette. We could then use ref values to reference them elsewhere in the theme.json files.

The colors can still be defined in the color palette, but perhaps under a descriptive name, e.g. "dark purple". This means that the names of these two colors in the color palette would not need to match their purpose (e.g. background, foreground, base, contrast).

I've created a PR to demonstrate the idea.

Change History (5)

This ticket was mentioned in PR #3657 on WordPress/wordpress-develop by @mikachan.

19 months ago

  • Keywords has-patch added

This PR replaces the base and contrast color palette names in Twenty Twenty-Three with descriptive names (e.g. "dark purple"), and uses ref values for where we were previously using var(--wp--preset--color--contrast) or var(--wp--preset--color--base).

I haven't included colors in the color palettes that are already included as part of Core, such as #000000 and #FFFFFF.

Trac ticket:

#2 @pbking
19 months ago

I rather think the values of 'base' and 'contrast' are too well established at this point to consider changing them at this point.

I'm also not keen on mixing descriptive and semantic colors in the theme palette. One or the other could make sense but combining them seems extra confusing.

Eliminating the values completely would be ideal but something I think we should consider for future themes (leveraging references to styles.color.text, styles.color.background once that is something that we have CSS variables for)

#3 @karmatosed
3 months ago

I am in two-minds here. I see the value in more descriptive, but I do think that base and contrast have become almost standard not just in this theme. @mikachan what are your feelings around this proposal now with the passing of time?

#4 @mikachan
3 months ago

👋 Thanks for the ping. I agree that base and contrast have become standard now in quite a lot of places, which I agree with, it's great to have some colour standards to work from.

I still like the general idea behind using styles.color.background and styles.color.text, but I think it would be best to explore this when we can use these keys as CSS variables as well as via a ref, like @pbking mentioned. So, I think we should close this for now and explore further options with variables over in the Gutenberg repo.

#5 @karmatosed
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Thank you @mikachan. Based on this I am going to close this ticket, thank you everyone for collaborating on this.

Note: See TracTickets for help on using tickets.