public static function fromRGB($red, $green, $blue)
    {
        if ($red < 0 || $red > 255 ||
            $green < 0 || $green > 255 ||
            $blue < 0 || $blue > 255) {
            throw new InvalidArgumentException('Values $red, $blue and $green can only be 0 to 255');
        }
        $red /= 255;
        $green /= 255;
        $blue /= 255;
        $min = min($red, $green, $blue);
        $max = max($red, $green, $blue);
        $delta = $max - $min;
        $hue = 0;
        $saturation = 0;
        $lightness = ($max + $min) / 2;
        if ($delta == 0) {
            // Achromatic
            return new self($hue, $saturation * 100, $lightness * 100);
        } else {
            $saturation = $delta / (1 - abs(2 * $lightness - 1));
            $hue = ($max == $green) ? 60 * (($blue - $red) / $delta + 2) : $hue;
            $hue = ($max == $blue) ? 60 * (($red - $green) / $delta + 4) : $hue;
            if ($max == $red) {
                $x = ($blue > $green) ? 360 : 0;
                $hue = 60 * fmod((($green - $blue) / $delta), 6) + $x;
            }

            return new self($hue, $saturation * 100, $lightness * 100);
        }
    }