RedeyeVentures\GeoPattern\GeoPattern::generateBackground PHP Method

generateBackground() protected method

Generators
protected generateBackground ( )
    protected function generateBackground()
    {
        $hueOffset = $this->map($this->hexVal(14, 3), 0, 4095, 0, 359);
        $satOffset = $this->hexVal(17, 1);
        $baseColor = $this->hexToHSL($this->baseColor);
        $color = $this->color;
        $baseColor['h'] = $baseColor['h'] - $hueOffset;
        if ($satOffset % 2 == 0) {
            $baseColor['s'] = $baseColor['s'] + $satOffset / 100;
        } else {
            $baseColor['s'] = $baseColor['s'] - $satOffset / 100;
        }
        if (isset($color)) {
            $rgb = $this->hexToRGB($color);
        } else {
            $rgb = $this->hslToRGB($baseColor['h'], $baseColor['s'], $baseColor['l']);
        }
        $this->svg->addRectangle(0, 0, "100%", "100%", ['fill' => "rgb({$rgb['r']}, {$rgb['g']}, {$rgb['b']})"]);
    }