mainColor > fgColor

This commit is contained in:
Miraty 2022-05-31 16:09:33 +02:00
parent 449d9634db
commit 8fdfb1b0a0
6 changed files with 15 additions and 15 deletions

View File

@ -17,4 +17,4 @@ define("DEFAULT_REDUNDANCY", "high");
define("DEFAULT_MARGIN", 20); define("DEFAULT_MARGIN", 20);
define("DEFAULT_SIZE", 300); define("DEFAULT_SIZE", 300);
define("DEFAULT_BGCOLOR", "FFFFFF"); define("DEFAULT_BGCOLOR", "FFFFFF");
define("DEFAULT_MAINCOLOR", "000000"); define("DEFAULT_FGCOLOR", "000000");

View File

@ -35,7 +35,7 @@ $params = array(
"margin" => DEFAULT_MARGIN, "margin" => DEFAULT_MARGIN,
"size" => DEFAULT_SIZE, "size" => DEFAULT_SIZE,
"bgColor" => DEFAULT_BGCOLOR, "bgColor" => DEFAULT_BGCOLOR,
"mainColor" => DEFAULT_MAINCOLOR, "fgColor" => DEFAULT_FGCOLOR,
); );
$validFormSubmitted = false; $validFormSubmitted = false;
@ -46,7 +46,7 @@ if (
AND isset($_POST['margin']) AND isset($_POST['margin'])
AND isset($_POST['size']) AND isset($_POST['size'])
AND isset($_POST['bgColor']) AND isset($_POST['bgColor'])
AND isset($_POST['mainColor']) AND isset($_POST['fgColor'])
) { ) {
if (strlen($_POST['txt']) >= 1 AND strlen($_POST['txt']) <= 4096) { if (strlen($_POST['txt']) >= 1 AND strlen($_POST['txt']) <= 4096) {
@ -88,11 +88,11 @@ if (
exit("Wrong value for bgColor"); exit("Wrong value for bgColor");
} }
if (preg_match("/^#[abcdefABCDEF0-9]{6}$/", $_POST['mainColor'])) { if (preg_match("/^#[abcdefABCDEF0-9]{6}$/", $_POST['fgColor'])) {
$params['mainColor'] = substr($_POST['mainColor'], -6); $params['fgColor'] = substr($_POST['fgColor'], -6);
} else { } else {
http_response_code(400); http_response_code(400);
exit("Wrong value for mainColor"); exit("Wrong value for fgColor");
} }
$validFormSubmitted = true; $validFormSubmitted = true;
@ -192,8 +192,8 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
<input type="color" name="bgColor" id="bgColor" value="#<?= htmlspecialchars($params['bgColor']) ?>"> <input type="color" name="bgColor" id="bgColor" value="#<?= htmlspecialchars($params['bgColor']) ?>">
</div> </div>
<div class="param"> <div class="param">
<label for="mainColor"><?= $loc['label_mainColor'] ?></label> <label for="fgColor"><?= $loc['label_fgColor'] ?></label>
<input type="color" name="mainColor" id="mainColor" value="#<?= htmlspecialchars($params['mainColor']) ?>"> <input type="color" name="fgColor" id="fgColor" value="#<?= htmlspecialchars($params['fgColor']) ?>">
</div> </div>
</div> </div>
@ -236,9 +236,9 @@ if ($validFormSubmitted) {
$rgbBgColor['b'] $rgbBgColor['b']
)) ))
->foregroundColor(new Color( ->foregroundColor(new Color(
hexdec(substr($params['mainColor'],0,2)), hexdec(substr($params['fgColor'],0,2)),
hexdec(substr($params['mainColor'],2,2)), hexdec(substr($params['fgColor'],2,2)),
hexdec(substr($params['mainColor'],4,2)) hexdec(substr($params['fgColor'],4,2))
)); ));
$result = $qrCode->build(); $result = $qrCode->build();

View File

@ -8,7 +8,7 @@ $loc = array(
'label_margin' => "Margin size", 'label_margin' => "Margin size",
'label_size' => "Image size", 'label_size' => "Image size",
'label_bgColor' => "Background color", 'label_bgColor' => "Background color",
'label_mainColor' => "Foreground color", 'label_fgColor' => "Foreground color",
'placeholder' => "Enter the text to encode in the QR code", 'placeholder' => "Enter the text to encode in the QR code",
'placeholder_pixels' => "automatic", 'placeholder_pixels' => "automatic",

View File

@ -8,7 +8,7 @@ $loc = array(
'label_margin' => "Taille de la marge", 'label_margin' => "Taille de la marge",
'label_size' => "Taille de l'image", 'label_size' => "Taille de l'image",
'label_bgColor' => "Couleur de fond", 'label_bgColor' => "Couleur de fond",
'label_mainColor' => "Couleur de premier plan", 'label_fgColor' => "Couleur de premier plan",
'placeholder' => "Entrez le texte à encoder dans le code QR", 'placeholder' => "Entrez le texte à encoder dans le code QR",
'placeholder_pixels' => "automatique", 'placeholder_pixels' => "automatique",

View File

@ -8,7 +8,7 @@ $loc = array(
'label_margin' => "Talha del marge", 'label_margin' => "Talha del marge",
'label_size' => "Talha de limatge", 'label_size' => "Talha de limatge",
'label_bgColor' => "Color de fons", 'label_bgColor' => "Color de fons",
'label_mainColor' => "Color del primièr plan", 'label_fgColor' => "Color del primièr plan",
'placeholder' => "Dintratz lo tèxt de codar en còdi QR", 'placeholder' => "Dintratz lo tèxt de codar en còdi QR",
'placeholder_pixels' => "auto", 'placeholder_pixels' => "auto",

View File

@ -8,7 +8,7 @@ $loc = array(
'label_margin' => "label_margin", 'label_margin' => "label_margin",
'label_size' => "label_size", 'label_size' => "label_size",
'label_bgColor' => "label_bgColor", 'label_bgColor' => "label_bgColor",
'label_mainColor' => "label_mainColor", 'label_fgColor' => "label_fgColor",
'placeholder' => "placeholder", 'placeholder' => "placeholder",
'placeholder_pixels' => "placeholder_pixels", 'placeholder_pixels' => "placeholder_pixels",