WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Specify a color palette is to be used for background colors only (or text colors only) #28146

Open paaljoachim opened 3 years ago

paaljoachim commented 3 years ago

Being able to show different default colors for text and background separately.

The question came up here: Defining separate colors for backgrounds and text

https://wordpress.org/support/topic/defining-separate-colors-for-backgrounds-and-text/

JustinyAhin commented 3 years ago

Looking at the code starting by https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/theme.php#L3689, it doesn't seem like this feature exists.

May worth opening a feature request on Trac

paaljoachim commented 3 years ago

I assume you mean a feature request issue here on the Gutenberg repo.

JustinyAhin commented 3 years ago

Huh 🤔, I guess we will need to register features for text color palette and background color palette and initialize the editor with it: https://gist.github.com/3a7cfd18695133af58d207bebbf0100f.git. This should normally happen on Trac.

mkaz commented 3 years ago

Justin, I think Paal (and the original question) were looking for documentation on how a user might set default colors using the block editor not for the documentation site. The snippet of code you included is correct, here is the documentation page for color palettes.

I think it still requires effort made on the theme side and not yet possible for a user to switch the defaults globally. So I'm not positive it is just a documentation issue. I've tagged it global styles and we can let someone from that team respond, there is also likely already a ticket for this somewhere.

paaljoachim commented 3 years ago

Ahhh..... Yes. I was talking about the Gutenberg plugin support question: https://wordpress.org/support/topic/defining-separate-colors-for-backgrounds-and-text/

"In the theme 2021, functions.PHP adds support for editor-color-palette as well as editor-gradient-presets. Is there a way to specify defaults for text colors separate from background colors? I want to define an array of text colors and a different array of background colors."

matthewmcvickar commented 3 years ago

I would love to be able to set two separate palettes for the 'Text Color' and 'Background Color' color settings. Is that what this ticket is tracking? I can't quite figure out what's going on in this ticket or the linked 'custom colors' ticket (#6941). Has there been any movement on this feature?

paaljoachim commented 3 years ago

Hey @matthewmcvickar

I mentioned this:

Is there a way to specify defaults for text colors separate from background colors?

I found the initial support request intriguing. As it feels natural to have one color palette for the text colors and another set of colors - color palette for the background color. I noticed you linked in: Core Component: Allow Saving Custom Colors to the Color Palette https://github.com/WordPress/gutenberg/issues/6941 I also noticed that 6941 links in many other issues as well.

I assume that this issue actually can be closed, as it is still a feature that needs to be worked on, and when merged it will be natural to extend the color palettes documentation.

cr0ybot commented 3 years ago

6941 was closed due to the introduction of theme.json, which does not address different palettes for background vs text.

I have been digging into the button block code for a few hours now to figure out if it is in any way possible to alter or remove the background color palette while leaving the text color palette alone, and I'm just not seeing a viable path. Maybe I'm missing something obvious, but I don't think this is about documentation, and I don't think this issue should be closed.

paaljoachim commented 3 years ago

Hey @cr0ybot

I made this issue: Allow Saving Custom Colors to the unique Color Palette for color og background (Might need to be renamed) https://github.com/WordPress/gutenberg/issues/34445

mkaz commented 3 years ago

I updated the ticket to clarify that it is not just a documentation change but a feature to allow for specifying a palette is specific for background only colors, or text only colors.

andreawetzel commented 1 month ago

A came across this Issue while trying to find a way to specify a palette specific to link colors. We would like our editors see Blue in the palette for link colors, but not for text and background colors.

Screenshot 2024-09-17 at 11 27 48 AM