Skip to content

Style tag instead of classnames for background- and text color in the editor #23274

Closed

Description

@bfiessinger

At the moment colors registered via add_theme_support( 'editor-color-palette', ... ) give us just the classname in the editor.

add_theme_support( 'editor-color-palette', [
    ...
    [
      'name' => __( 'Envy', 'textdomain' ),
      'slug' => 'envy',
      'color' => '#87A38F',
    ],
    [
      'name' => __( 'Pink', 'textdomain' ),
      'slug' => 'pink',
      'color' => '#a6186f',
    ],
    ...
] );

That means as a Theme Developer you have to manually add a stylesheet in the editor containing the styles related to text- and background color. Otherwise the preview looks something like this:
color

Imo it would be a better solution to add the color via style tag in the editor to make things easier.

Activity

  1. oxyc commented on Jun 18, 2020

    @oxyc
    Member

    I think it's related to #21931 (comment) #22356

  2. bfiessinger commented on Jun 26, 2020

    @bfiessinger
    Author

    I'm closing this as it looks like it should have this behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions