• julian_wave

    (@julian_wave)


    Is it possible to stop people from being able to select foreground and background colors for a block, while still allowing them to use the inline “Highlight” tool to color individual words or characters? I can see how to disable the color palette altogether in theme.json, but that is not what I want.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    You could hide the applicable panel with CSS. Knowledgeable users could easily unhide it, but hiding should deter nearly everyone. For example:

    .color-block-support-panel {
        display: none;
    }

    Custom CSS is supposed to be enqueued through “admin_enqueue_scripts” as an external file. Kind of overkill for just a couple lines of CSS. An alternative would be to output your own inline style block using the “wp_print_styles” action. This approach is a little hacky and somewhat frowned upon, but you are free to do as you wish with your own site.

    Thread Starter julian_wave

    (@julian_wave)

    Thanks, that should work when I want to hide the colors panel for every kind of block. However I’m not sure if it would work if I only wanted to hide the colors panel for some blocks and not others.

    Before Gutenberg you could create ‘highlight’ style options by adding custom classes into the wysiwyg format selector – I’m looking for a way to allow specific highlighting with core Gutenberg blocks, without letting clients add inappropriate colors to the text and background of entire blocks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Gutenberg – disable color selector for core blocks’ is closed to new replies.