Using color variables in WP Gutenberg color palette - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, April 22, 2023

Using color variables in WP Gutenberg color palette

I'm trying to use colors selected in the customizer to change the theme colors in the Gutenberg editor. I'm using metabox to set the theme colors. I'm missing something.

This is essentially what I'm trying to do. It doesn't work. Any ideas?

$primary = rwmb_meta( 'primary_color', [ 'object_type' => 'setting' ], 'site_settings' );

add_theme_support( 'editor-color-palette', array(
    array(
        'name'  => __( 'Primary', 'themeLangDomain' ),
        'slug'  => 'primary',
        'color' => '$primary',
    ),


source https://stackoverflow.com/questions/76075736/using-color-variables-in-wp-gutenberg-color-palette

No comments:

Post a Comment