WC_Twenty_Nineteen::custom_colors_css()public staticWC 1.0

Filters Twenty Nineteen custom colors CSS.

Method of the class: WC_Twenty_Nineteen{}

Return

null. Nothing (null).

Usage

$result = WC_Twenty_Nineteen::custom_colors_css( $css, $primary_color, $saturation );
$css(string) (required)
Base theme colors CSS.
$primary_color(int) (required)
The user's selected color hue.
$saturation(string) (required)
Filtered theme color saturation level.

WC_Twenty_Nineteen::custom_colors_css() code WC 9.4.2

public static function custom_colors_css( $css, $primary_color, $saturation ) {
	if ( function_exists( 'register_block_type' ) && is_admin() ) {
		return $css;
	}

	$lightness = absint( apply_filters( 'twentynineteen_custom_colors_lightness', 33 ) );
	$lightness = $lightness . '%';

	$css .= '
		.onsale,
		.woocommerce-info,
		.woocommerce-store-notice {
			background-color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
		}

		.woocommerce-tabs ul li.active a {
			color: hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
			box-shadow: 0 2px 0 hsl( ' . $primary_color . ', ' . $saturation . ', ' . $lightness . ' );
		}
	';

	return $css;
}