theme_colors( ?array $override_styles = null ) { if ( ! function_exists( 'wp_get_global_styles' ) ) { return array(); } $global_styles = $override_styles ?: wp_get_global_styles( array(), array( 'transforms' => array( 'resolve-variables' ) ) ); $default_colors = EmailColors::get_default_colors(); $base_color_default = $default_colors['base_color_default']; $bg_color_default = $default_colors['bg_color_default']; $body_bg_color_default = $default_colors['body_bg_color_default']; $body_text_color_default = $default_colors['body_text_color_default']; $footer_text_color_default = $default_colors['footer_text_color_default']; $base_color = ! empty( $global_styles['elements']['button']['color']['background'] ) ? sanitize_hex_color( $global_styles['elements']['button']['color']['background'] ) : $base_color_default; $bg_color = ! empty( $global_styles['color']['background'] ) ? sanitize_hex_color( $global_styles['color']['background'] ) : $bg_color_default; $body_bg_color = ! empty( $global_styles['color']['background'] ) ? sanitize_hex_color( $global_styles['color']['background'] ) : $body_bg_color_default; $body_text_color = ! empty( $global_styles['color']['text'] ) ? sanitize_hex_color( $global_styles['color']['text'] ) : $body_text_color_default; $footer_text_color = ! empty( $global_styles['elements']['caption']['color']['text'] ) ? sanitize_hex_color( $global_styles['elements']['caption']['color']['text'] ) : $footer_text_color_default; return array( 'base_color' => $base_color, 'bg_color' => $bg_color, 'body_bg_color' => $body_bg_color, 'body_text_color' => $body_text_color, 'footer_text_color' => $footer_text_color, ); } }