Leafo\ScssPhp\Compiler::libScaleColor PHP Method

libScaleColor() protected method

protected libScaleColor ( $args )
    protected function libScaleColor($args)
    {
        return $this->alterColor($args, function ($base, $scale, $i) {
            // 1, 2, 3 - rgb
            // 4, 5, 6 - hsl
            // 7 - a
            switch ($i) {
                case 1:
                case 2:
                case 3:
                    $max = 255;
                    break;
                case 4:
                    $max = 360;
                    break;
                case 7:
                    $max = 1;
                    break;
                default:
                    $max = 100;
            }
            $scale = $scale / 100;
            if ($scale < 0) {
                return $base * $scale + $base;
            }
            return ($max - $base) * $scale + $base;
        });
    }
Compiler