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

Reduce color palette options for button block #13341

Closed
billerickson opened this issue Jan 16, 2019 · 11 comments
Closed

Reduce color palette options for button block #13341

billerickson opened this issue Jan 16, 2019 · 11 comments
Labels
[Block] Buttons Affects the Buttons Block [Feature] Extensibility The ability to extend blocks or the editing experience

Comments

@billerickson
Copy link

I'd love the ability to restrict the button block's color options for background color / text color to a subset of the editor-color-palette.

We typically have 6-10 colors in our editor-color-palette, but want 2-3 button variations.

Is it possible to reduce the color options on a per-block-type basis?

@swissspidy swissspidy added the [Block] Buttons Affects the Buttons Block label Jan 16, 2019
@samhermes
Copy link

Would love to see this as well, for the same reason.

@buhlahkay
Copy link

Would like to see this on all blocks as @billerickson mentions. Or even the ability to remove the "Color Settings" tab completely from certain blocks.

@carasmo
Copy link

carasmo commented Jan 25, 2020

There ought to be some kind of filter(s) to allow background colors for certain blocks and not allow them for others as well as what Mr. Erickson wrote.

@reedcodes
Copy link

We have a similar situation. Two main brand colors, four secondary, five tertiary. We only want to use five colors on the buttons, two on the alerts, eight on the callouts, etc.

@youknowriad
Copy link
Contributor

We're working on a way to control the presets per block in #20588

@youknowriad youknowriad added the [Feature] Extensibility The ability to extend blocks or the editing experience label Aug 26, 2020
@mtias
Copy link
Member

mtias commented Jul 13, 2021

This is now possible via theme.json, closing as done.

@mtias mtias closed this as completed Jul 13, 2021
@ellenbauer
Copy link

Could someone kindly hint me to how I can get this done via theme.json. Is there another ticket or other form of documentation already available? That would be awesome, thanks so much.

@mtias
Copy link
Member

mtias commented Jul 14, 2021

@ellenbauer sure thing! You can set a custom color palette just for the button block like this:

{
  "settings": {
    "core/button": {
      "color": {
        "palette": []
      }
    }
  } 
}

@oandregal
Copy link
Member

Added this as an example at https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json/#settings-examples

@ellenbauer
Copy link

Awesome, thank you so much @mtias for pointing me into the right direction. That is such a helpful add-on to be able to customize the color palette per block.
Also thank you @nosolosw for updating the documentation.

@mtias
Copy link
Member

mtias commented Jul 15, 2021

Agreed! It's a large part of what makes the addition of theme.json worth it, since it scales to any block, including third-party ones as long as it uses the block supports APIs, and should offer a lot of flexibility for site maintainers and themes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block [Feature] Extensibility The ability to extend blocks or the editing experience
Projects
None yet
Development

No branches or pull requests

10 participants