WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 11 days ago

#49803 new enhancement

Allow for add_theme_support( 'editor-color-palette' ) to append to default palette

Reported by: wolfpaw Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords: close
Focuses: ui Cc:

Description

Currently, you can use add_theme_support( 'editor-color-palette' ) to create a new palette of colors to choose from while editing posts. I'd like the ability to append custom colors to the palette, as opposed to entirely replacing the existing palette.

Change History (1)

#1 @noisysocks
11 days ago

  • Keywords close added
  • Version set to 5.0

Hi @wolfpaw. You should be able to do this by calling get_theme_support(), appending to the return value, and then calling add_theme_support() again.

$editor_color_palette = get_theme_support( 'editor-color-palette' );
$editor_color_palette[] = array( ...whatever... );
add_theme_support( 'editor-color-palette', $editor_color_palette );

I don't think that a dedicated API for this is necessary.

Note: See TracTickets for help on using tickets.