You are here

private static function Kint_Parsers_Color::_hue2rgb in Devel 8.2

Same name and namespace in other branches
  1. 8 kint/kint/parsers/custom/color.php \Kint_Parsers_Color::_hue2rgb()

* Helper function for _color_hsl2rgb().

1 call to Kint_Parsers_Color::_hue2rgb()
Kint_Parsers_Color::_HSLtoRGB in kint/kint/parsers/custom/color.php

File

kint/kint/parsers/custom/color.php, line 199

Class

Kint_Parsers_Color

Code

private static function _hue2rgb($m1, $m2, $h) {
  $h = $h < 0 ? $h + 1 : ($h > 1 ? $h - 1 : $h);
  if ($h * 6 < 1) {
    return $m1 + ($m2 - $m1) * $h * 6;
  }
  if ($h * 2 < 1) {
    return $m2;
  }
  if ($h * 3 < 2) {
    return $m1 + ($m2 - $m1) * (0.66666 - $h) * 6;
  }
  return $m1;
}