[Support request] Restricting color palette ONLY to glabal colors. Possible?

Home Forums Support [Support request] Restricting color palette ONLY to glabal colors. Possible?

Home Forums Support Restricting color palette ONLY to glabal colors. Possible?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2343382
    Luca

    Hi,

    Is there a way to restrict the color palette to show only the GP global colors for non-admin users? So that site editors can only use the theme palette and not add other colors?

    Thanks,

    #2343445
    Fernando
    Customer Support

    Hi Luca,

    If your using a Child theme, you can try enqueueing your own style in the Block Editor.

    For instance, in your Child Theme directory, you create a new file called my-editor-style.css

    Then, add this PHP in functions.php:

    add_action( 'enqueue_block_editor_assets', function() {
    if( !current_user_can( 'manage_options' ) ) {
    	wp_enqueue_style( 'my-block-editor-styles', get_stylesheet_directory_uri() . "/my-editor-style.css", false,'1.0', 'all' );
    }
    } );

    Your my-editor-style.css should have this code:

    .react-colorful {
    	display: none !important;
    }
    #2343608
    Luca

    Hi Fernando,

    I was hoping there was a filter for that, but then I will go the CSS way (as it’s really 1 line of CSS I will probably use wp_add_inline_style within the anonymous function).

    Anyways, thanks a lot.

    #2344273
    Fernando
    Customer Support

    You’re welcome Luca!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.