Automattic\WooCommerce\EmailEditor\Engine\Renderer\ContentRenderer
Rendering_Context::translate_slug_to_color
Translate a color slug to the color the palette gives it.
A slug can be missing from the palette because the post was written under a different theme, or came from a palette the email does not carry. Styles_Helper::resolve_color_from_palette().
Method of the class: Rendering_Context{}
No Hooks.
Returns
string. The color value, or an empty string for a slug the palette does not define.
Usage
$Rendering_Context = new Rendering_Context(); $Rendering_Context->translate_slug_to_color( $color_slug ): string;
- $color_slug(string) (required)
- Color slug, or a literal color.
Rendering_Context::translate_slug_to_color() Rendering Context::translate slug to color code WC 11.3.0
public function translate_slug_to_color( string $color_slug ): string {
return Styles_Helper::resolve_color_from_palette( $this->get_theme_settings(), $color_slug );
}