0) { $s = 100 * ( $chroma / $max_rgb ); if ( $r === $min_rgb ) { $h = 3 - ( ( $g - $b ) / $chroma ); } elseif ( $b === $min_rgb ) { $h = 1 - ( ( $r - $g ) / $chroma ); } else { // $g === $min_rgb $h = 5 - ( ( $b - $r ) / $chroma ); } $h = 60 * $h; return array( $h, $s, $v, $l ); } else { return array( 0, 0, $v, $l ); } } } if ( ! function_exists( 'change_color_luminescence' ) ) { function change_color_luminescence( $hex, $amount ) { $hex_without_hash = substr( $hex, 1, strlen( $hex ) ); $rgb = hex_to_rgb( $hex_without_hash ); $hsvl = rgb_to_hsvl( $rgb ); return 'hsl( ' . $hsvl[0] . ',' . $hsvl[1] . '%,' . ( $hsvl[2] + $amount ) . '%)'; } } /** * Custom CSS. * The plugin takes the body of this function and applies it in a style tag in the document head. */ function seedlet_custom_colors_extra_css() { $colors_array = get_theme_mod( 'colors_manager' ); $background = $colors_array['colors']['bg'] ?? ''; $foreground = $colors_array['colors']['txt'] ?? ''; $primary = $colors_array['colors']['link'] ?? ''; $secondary = $colors_array['colors']['fg1'] ?? ''; $tertiary = $colors_array['colors']['fg2']; $foreground_low_contrast = change_color_luminescence( $foreground, 10 ); $foreground_high_contrast = change_color_luminescence( $foreground, -10 ); $primary_hover = change_color_luminescence( $primary, 10 ); $secondary_hover = change_color_luminescence( $secondary, 10 ); ?> :root, #editor .editor-styles-wrapper { --global--color-background: ; --global--color-foreground: ; --global--color-foreground-low-contrast: ; --global--color-foreground-high-contrast: ; --global--color-primary: ; --global--color-primary-hover: ; --global--color-secondary: ; --global--color-secondary-hover: ; --global--color-tertiary: ; }