Skip to content

Theme palette color not showing on buttons in Gmail #7856

@pixel21

Description

@pixel21

Steps to Reproduce

  1. Go to Sensei -> Settings -> Emails
  2. Click on any of the email template to edit it
  3. Insert or change the button background to any color from the theme palette
Image
  1. Sign up or purchase a course and open the email in Gmail

What I Expected

I expected the button to show in the same color that I selected in the email editor

What Happened Instead

The email in Gmail looks like this

Image

The button shows up with a transparent background.

PHP / WordPress / Sensei LMS version

PHP - 8.3
WordPress - 6.8.3
Theme - Twentytwentyfive
Sensei LMS version - 4.24.5

Browser / OS version

Chrome 140.0.7339.134 on Mac Sequoia 15.6.1

Context / Source

Once I disable the theme palette from appearing in the button background color choice and select a custom color, it shows up fine in Gmail

Image

Here's the code that I used to disable the theme palette from sensei email template

function twentytwentyfive_remove_theme_colors_sensei_email( $settings, $context ) {
    if ( ! isset( $context->post ) || 'sensei_email' !== $context->post->post_type ) {
        return $settings;
    }

    if ( isset( $settings['color']['palette']['theme'] ) ) {
        unset( $settings['color']['palette']['theme'] );
    }

    if ( isset( $settings['__experimentalFeatures']['color']['palette']['theme'] ) ) {
        unset( $settings['__experimentalFeatures']['color']['palette']['theme'] );
    }

    return $settings;
}
add_filter( 'block_editor_settings_all', 'twentytwentyfive_remove_theme_colors_sensei_email', 9, 2 );

There was an old PR to disable default palette which was causing a similar issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions