diff --git a/src/GeoPattern/GeoPattern.php b/src/GeoPattern/GeoPattern.php index 12e6225..e07db6e 100644 --- a/src/GeoPattern/GeoPattern.php +++ b/src/GeoPattern/GeoPattern.php @@ -142,20 +142,28 @@ public function __toString() { } // Generators - 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; + public function generateColors(){ + $hueOffset = $this->map($this->hexVal(14, 3), 0, 4095, 0, 359); + $satOffset = $this->hexVal(17, 1); + $baseColor = $this->hexToHSL($this->baseColor); - $baseColor['h'] = $baseColor['h'] - $hueOffset; + $baseColor['h'] = $baseColor['h'] - $hueOffset; - if ($satOffset % 2 == 0) - $baseColor['s'] = $baseColor['s'] + $satOffset/100; - else - $baseColor['s'] = $baseColor['s'] - $satOffset/100; + if ($satOffset % 2 == 0) + $baseColor['s'] = $baseColor['s'] + $satOffset/100; + else + $baseColor['s'] = $baseColor['s'] - $satOffset/100; + + $baseColor['rgb'] = $this->hslToRGB($baseColor['h'], $baseColor['s'], $baseColor['l']); + + return $baseColor; + } + + protected function generateBackground() + { + $baseColor = $this->generateColors(); + $color = $this->color; if (isset($color)) $rgb = $this->hexToRGB($color);