mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-24 19:37:57 +00:00
:octocat: removed QROptionsTrait::$markupDark and QROptionsTrait::$markupLight, added QROptionsTrait::$svgUseFillAttributes
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user