:octocat: removed QROptionsTrait::$markupDark and QROptionsTrait::$markupLight, added QROptionsTrait::$svgUseFillAttributes

This commit is contained in:
smiley
2023-10-14 23:45:14 +02:00
parent 07eb6e38ff
commit dfb7728d37
10 changed files with 82 additions and 89 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ class QRImagick extends QROutputAbstract{
* @inheritDoc
*/
protected function getDefaultModuleValue(bool $isDark):ImagickPixel{
return $this->prepareModuleValue(($isDark) ? $this->options->markupDark : $this->options->markupLight);
return $this->prepareModuleValue(($isDark) ? '#000' : '#fff');
}
/**
+1 -1
View File
@@ -65,7 +65,7 @@ abstract class QRMarkup extends QROutputAbstract{
* @inheritDoc
*/
protected function getDefaultModuleValue(bool $isDark):string{
return ($isDark) ? $this->options->markupDark : $this->options->markupLight;
return ($isDark) ? '#000' : '#fff';
}
/**
+10
View File
@@ -145,6 +145,16 @@ class QRMarkupSVG extends QRMarkup{
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path
*/
protected function path(string $path, int $M_TYPE):string{
if($this->options->svgUseFillAttributes){
return sprintf(
'<path class="%s" fill="%s" d="%s"/>',
$this->getCssClass($M_TYPE),
$this->getModuleValue($M_TYPE),
$path
);
}
return sprintf('<path class="%s" d="%s"/>', $this->getCssClass($M_TYPE), $path);
}
+4 -20
View File
@@ -362,17 +362,6 @@ trait QROptionsTrait{
*/
protected string $cssClass = 'qrcode';
/**
* Markup substitute for dark (CSS value)
*/
protected string $markupDark = '#000';
/**
* Markup substitute for light (CSS value)
*/
protected string $markupLight = '#fff';
/*
* QRMarkupSVG settings
*/
@@ -384,15 +373,6 @@ trait QROptionsTrait{
*/
protected bool $svgAddXmlHeader = true;
/**
* SVG path opacity
*
* Sets the value for the SVG "fill-opacity" on a `<path>` element. Only in effect when non-empty values
* for `QROptions::$markupDark` and `QROptions::$markupLight` are given.
* The opacity value is the same for all paths - please use CSS for more sophisticated implementations.
*/
protected float $svgOpacity = 1.0;
/**
* Anything in the SVG `<defs>` tag
*
@@ -420,6 +400,10 @@ trait QROptionsTrait{
*/
protected string $svgPreserveAspectRatio = 'xMidYMid';
/**
* Whether to use the SVG `fill` attributes and set them with the given module values
*/
protected bool $svgUseFillAttributes = true;
/*
* QRString settings