diff --git a/cobertura.xml b/cobertura.xml index 338d454..e64e903 100644 --- a/cobertura.xml +++ b/cobertura.xml @@ -1,6 +1,6 @@ - + /home/thomas/projekte/calc/src @@ -6116,9 +6116,9 @@ - + - + @@ -6255,45 +6255,69 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - + - + - + - + @@ -6402,18 +6426,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Option/Parser/Select.php b/src/Option/Parser/Select.php index 53e8280..e923d67 100644 --- a/src/Option/Parser/Select.php +++ b/src/Option/Parser/Select.php @@ -219,7 +219,43 @@ class Select extends Base private function parseModeColorDbJson(): void { - $this->element->setContainer((string) $this->json['container']); + $colorSystem = (string) $this->json['container']; + + $this->element->setContainer($colorSystem); + + $value = $this->cache->get($colorSystem, function (ItemInterface $item) use ($colorSystem): array { + $item->expiresAfter(3600); + + $temp = []; + + if (str_contains($colorSystem, 'panton')) { + $system = new PANTONE(\Color\System\Enum\PANTONE::from($colorSystem)); + } + if (str_contains($colorSystem, 'hks')) { + $system = new HKS(\Color\System\Enum\HKS::from($colorSystem)); + } + + if ($system) { + foreach ($system->getAllColors() as $color) { + $optColor = new \PSC\Library\Calc\Option\Type\Select\ColorOpt(); + $optColor->setId($color->getName()); + $optColor->setLabel($color->getValue('name')); + $optColor->setPrefix($system->getColorSystemPrefix()); + $optColor->setSuffix($system->getColorSystemSuffix()); + $optColor->setColorHex((string) $color->getHex()); + $optColor->setColorCMYK((string) $color->getCMYK()); + $optColor->setColorRGB((string) $color->getRGB()); + $optColor->setValue((string) $color->getHEX()); + $temp[] = $optColor; + } + } + + return $temp; + }); + + $this->element->setColorSystem($colorSystem); + + $this->element->addOptions($value); } private function parseModeNormalXML()