{
// Main texts color
$this->sassVariables['texts-color'] = $this->theme->getTextsColor();
+ $this->sassVariables['opposite-texts-color'] = $this->theme->getTextsColor(true);
// Font
$this->sassVariables['font'] = $this->_font($this->theme->font);
// Colors
$this->addField('outroFailAnimation', Hidden::class, __('Animation d\'échec'), ['hint' => __('390 x 390px')]);
}
- public function getTextsColor()
+ public function getTextsColor($opposite = false)
{
$darkColor = '#383838';
$lightColor = '#ffffff';
$distBlack = $neutral->distance($black);
$distWhite = $neutral->distance($white);
if ($distWhite > $distBlack) {
- return $lightColor;
+ $res = $lightColor;
} else {
- return $darkColor;
+ $res = $darkColor;
}
+ } else {
+ $res = match ($this->textColor) {
+ 'dark' => $darkColor,
+ '#000000' => $darkColor,
+ '#ffffff' => $lightColor,
+ 'light' => $lightColor,
+ };
+ }
+
+ if (!$opposite) {
+ return $res;
+ }
+
+ if ($res === $darkColor) {
+ return $lightColor;
+ } else {
+ return $darkColor;
}
- return match ($this->textColor) {
- 'dark' => $darkColor,
- '#000000' => $darkColor,
- '#ffffff' => $lightColor,
- 'light' => $lightColor,
- };
}
/**