WC_Twenty_Nineteen::custom_colors_css()public staticWC 1.0

Filters Twenty Nineteen custom colors CSS.

Метод класса: WC_Twenty_Nineteen{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$result = WC_Twenty_Nineteen::custom_colors_css( $css, $primary_color, $saturation );
$css(строка) (обязательный)
Base theme colors CSS.
$primary_color(int) (обязательный)
The user's selected color hue.
$saturation(строка) (обязательный)
Filtered theme color saturation level.

Код WC_Twenty_Nineteen::custom_colors_css() WC 8.7.0

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;
}