• Hi,

    We set a custom color palette for our website using add_theme_support(
    ‘editor-color-palette’, array) function. It was working well, but after the 5.9 updates, it’s not working and custom colors are not displaying in the editor.

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • To check your message it would be good if you could provide the complete code you used here. Then it would be possible to have a look at it. Independently of this, you can also take a look at the manual where it is also described for 5.9 how to use color palettes: https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/

    Thread Starter Awais

    (@imawais)

    Thank you for your response threadi. Here is the code which works well with wordpress 5.8 but does not work after WP 5.9 Update.

    /**
    * Add custom color palette in Block editor.
    */
    function my_gutenberg_color_palette() {
    add_theme_support(
    ‘editor-color-palette’, array(
    array(
    ‘name’ => esc_html__( ‘Pink’, ‘@@textdomain’ ),
    ‘slug’ => ‘modified-pink’,
    ‘color’ => ‘#ff698f’,
    ),
    array(
    ‘name’ => esc_html__( ‘Green’, ‘@@textdomain’ ),
    ‘slug’ => ‘modified-green’,
    ‘color’ => ‘#009705’,
    ),
    array(
    ‘name’ => esc_html__( ‘Gray’, ‘@@textdomain’ ),
    ‘slug’ => ‘modified-gray’,
    ‘color’ => ‘#a8aaaa’,
    ),
    array(
    ‘name’ => esc_html__( ‘Blue’, ‘@@textdomain’ ),
    ‘slug’ => ‘modified-blue’,
    ‘color’ => ‘#0412cc’,
    ),
    array(
    ‘name’ => esc_html__( ‘Pale pink’, ‘@@textdomain’ ),
    ‘slug’ => ‘pale-pink’,
    ‘color’ => ‘#f78da7’,
    ),
    array(
    ‘name’ => esc_html__( ‘Vivid red’, ‘@@textdomain’ ),
    ‘slug’ => ‘vivid-red’,
    ‘color’ => ‘#cf2e2e’,
    ),
    array(
    ‘name’ => esc_html__( ‘Luminous vivid orange’, ‘@@textdomain’ ),
    ‘slug’ => ‘luminous-vivid-orange’,
    ‘color’ => ‘#ff6900’,
    ),
    array(
    ‘name’ => esc_html__( ‘Luminous vivid amber’, ‘@@textdomain’ ),
    ‘slug’ => ‘luminous-vivid-amber’,
    ‘color’ => ‘#fcb900’,
    ),
    array(
    ‘name’ => esc_html__( ‘Light green cyan’, ‘@@textdomain’ ),
    ‘slug’ => ‘light-green-cyan’,
    ‘color’ => ‘#7bdcb5’,
    ),
    array(
    ‘name’ => esc_html__( ‘Vivid green cyan’, ‘@@textdomain’ ),
    ‘slug’ => ‘vivid-green-cyan’,
    ‘color’ => ‘#00d084’,
    ),
    array(
    ‘name’ => esc_html__( ‘Pale cyan blue’, ‘@@textdomain’ ),
    ‘slug’ => ‘pale-cyan-blue’,
    ‘color’ => ‘#8ed1fc’,
    ),
    array(
    ‘name’ => esc_html__( ‘Vivid cyan blue’, ‘@@textdomain’ ),
    ‘slug’ => ‘vivid-cyan-blue’,
    ‘color’ => ‘#0693e3’,
    ),
    array(
    ‘name’ => esc_html__( ‘Vivid purple’, ‘@@textdomain’ ),
    ‘slug’ => ‘vivid-purple’,
    ‘color’ => ‘#9b51e0’,
    ),
    array(
    ‘name’ => esc_html__( ‘Very light gray’, ‘@@textdomain’ ),
    ‘slug’ => ‘very-light-gray’,
    ‘color’ => ‘#eeeeee’,
    ),
    array(
    ‘name’ => esc_html__( ‘Cyan bluish gray’, ‘@@textdomain’ ),
    ‘slug’ => ‘cyan-bluish-gray’,
    ‘color’ => ‘#abb8c3’,
    ),
    array(
    ‘name’ => esc_html__( ‘Very dark gray’, ‘@@textdomain’ ),
    ‘slug’ => ‘very-dark-gray’,
    ‘color’ => ‘#313131’,
    )
    )
    );
    }
    add_action( ‘after_setup_theme’, ‘my_gutenberg_color_palette’, 999 );

    add_action( ‘enqueue_block_editor_assets’, ‘my_guten_enqueue’, 999 );
    function my_guten_enqueue() {
    wp_enqueue_style(
    ‘my_guten-style’,
    get_stylesheet_directory_uri() . ‘/mycustomcolors.css’,
    null,
    ‘1.0.3’
    );
    }

    /* code for enqueued mycustomcolors.css file*/

    .has-modified-pink-background-color {
         background-color: #ff698f !important;
     }
    .has-modified-pink-color {
         color: #ff698f !important;
    }
    
    .has-modified-green-background-color {
         background-color: #009705 !important;
    }
    .has-modified-green-color {
         color: #009705 !important;
    }
    
    .has-modified-blue-background-color {
         background-color: #0412cc !important;
     }
    .has-modified-blue-color {
         color: #0412cc !important;
    }
    
    .has-modified-gray-background-color {
         background-color: #a8aaaa !important;
     }
    .has-modified-gray-color {
         color: #a8aaaa !important;
    }
    • This reply was modified 2 years, 2 months ago by Awais.
    nappa5150

    (@nappa5150)

    Hi!

    I have the same problem. after updating WP to 5.9.3 the custom color palette disappear. Here the code

    add_theme_support('editor-color-palette', array(
        array(
            'name' => __('sbevizzola', 'nap-color'),
            'slug' => 'sbevizzola',
            'color' => '#7f1f55',
        ),
    ));
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Editor Color Palette Disappeared after WP 5.9 Update’ is closed to new replies.