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

Adding custom color options for blocks #129

Closed
bph opened this issue Jun 2, 2023 Discussed in #106 · 8 comments
Closed

Adding custom color options for blocks #129

bph opened this issue Jun 2, 2023 Discussed in #106 · 8 comments

Comments

@bph
Copy link
Collaborator

bph commented Jun 2, 2023

Discussed in #106

Originally posted by justintadlock May 2, 2023
Sometimes, block developers need to add custom color options that are not available as the default Text, Background, and Link color supports, as shown in this screenshot:

image

This question pops up from time to time, and it'd be good to have a solid resource on how to accomplish it. I've already written code for this in a plugin of my own: https://github.com/x3p0-dev/x3p0-progress/blob/1.0/resources/js/color/panel-color.js

Some things to note:

  • You cannot add colors to the default "Color" panel. You must build a custom panel.
  • You can add individual colors to other custom panels.
@bph bph moved this to Topic needs approval in Developer Blog Content Board Jun 3, 2023
@bph bph moved this from Topic needs approval to To-do in Developer Blog Content Board Jun 3, 2023
@justintadlock
Copy link

I'll be working on this tutorial from this Google Doc: https://docs.google.com/document/d/1Gh1YnnUWm6Q_WCSglglsmlbTMml23d3-D-pH0VF6bn0/edit?usp=sharing

@justintadlock justintadlock moved this from To-do to In Progress in Developer Blog Content Board Oct 16, 2023
@justintadlock
Copy link

Here's the repo that I'll be building the code examples in: https://github.com/justintadlock/custom-block-color-settings

I'll transfer it to the Learn organization once it's finalized.

@justintadlock justintadlock moved this from In Progress to Needs 1st review in Developer Blog Content Board Oct 24, 2023
@justintadlock
Copy link

The draft for this post is now finished and ready for review: https://docs.google.com/document/d/1Gh1YnnUWm6Q_WCSglglsmlbTMml23d3-D-pH0VF6bn0/edit?usp=sharing

@marybaum
Copy link
Member

Got it!

@abhansnuk
Copy link

Hi @justintadlock a great tutorial. I have done a review and added some comments to the doc. Look forward to building following your steps.

@abhansnuk abhansnuk moved this from Needs 1st review to Needs 2nd review in Developer Blog Content Board Nov 1, 2023
@justintadlock justintadlock moved this from Needs 2nd review to Ready to publish in Developer Blog Content Board Nov 1, 2023
@justintadlock
Copy link

Props to @juanmaguitar for second review. We're ready to publish now.

@justintadlock
Copy link

And we're live! https://developer.wordpress.org/news/2023/11/how-to-add-custom-color-options-to-blocks/

Social copy:

Have you ever needed to add extra color options to your custom blocks? If so, check out this tutorial on the WordPress Developer Blog to find out how:

https://developer.wordpress.org/news/2023/11/how-to-add-custom-color-options-to-blocks/

@justintadlock justintadlock moved this from Ready to publish to Published (Done) in Developer Blog Content Board Nov 1, 2023
@ndiego
Copy link
Member

ndiego commented Jan 29, 2024

Social post scheduled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Published (Done)
Development

No branches or pull requests

5 participants