0.5 ? $d / (2 - $max - $min) : $d / ($max + $min); switch ($max) { case $r: $h = ($g - $b) / $d + ($g < $b ? 6 : 0); break; case $g: $h = ($b - $r) / $d + 2; break; case $b: $h = ($r - $g) / $d + 4; break; } $h /= 6; } return array(round($h * 360), round($s * 100), round($l * 100)); } // Get the primary color from the Customizer $blogtube_primary_color = esc_attr(get_theme_mod('primary_color', '#3ea6ff')); // Convert the primary color to HSL list($blogtube_primary_hue, $blogtube_saturation, $lightness) = blogtube_hex2hsl($blogtube_primary_color); $blogtube_lightness = 50; // Define other colors based on the primary color $blogtube_primary_variant_darker = "hsl($blogtube_primary_hue, " . (max(0, $blogtube_saturation - 20)) . "%, " . (max(0, $blogtube_lightness - 40)) . "%)"; ?>