const OK_COLOR = '#16BFBF';
const NOK_COLOR = '#D0167C';
const CONFETTI_COLOR = '#E4FF19';
-
- const TEXT_COLOR = "#ffffff";
+ const TEXT_COLOR = "#66666F";
+ const BUTTON_TEXT_COLOR = "#33333F";
protected $animations = [];
protected function writeAnimations()
{
$colors = [
+ self::BUTTON_TEXT_COLOR => $this->theme->getButtonTextColor(),
+ self::TEXT_COLOR => $this->theme->getTextsColor(),
self::OK_COLOR => $this->theme->okColor,
self::CONFETTI_COLOR => $this->theme->okColor,
self::NOK_COLOR => $this->theme->nokColor,
- self::TEXT_COLOR => $this->theme->getTextsColor(),
];
$animationReplace = [];
$animationPregReplace = [];
{
$this->addField('sectionTexts', FormSection::class, __('Textes'));
$this->addField('textColor', SelectFromArray::class, __('Couleur des textes'), ['default' => 'auto', 'options' => ['auto' => __('Automatique'), 'light' => __('Blanc'), 'dark' => __('Noir')]]);
+ $this->addField('buttonTextColor', SelectFromArray::class, __('Couleur de texte du bouton principal'), ['default' => 'auto', 'options' => ['auto' => __('Automatique'), 'light' => __('Blanc'), 'dark' => __('Noir')]]);
$this->addField('font', FluidbookFont::class, __('Police de caractères'), ['default' => 'SourceSans', 'databaseDefault' => 'SourceSans']);
}
}
public function getTextsColor($opposite = false)
+ {
+ return $this->_getAutoTextColor($this->neutralColor, $this->textColor, $opposite);
+ }
+
+ public function getButtonTextColor($opposite = false)
+ {
+ return $this->_getAutoTextColor($this->mainColor, $this->buttonTextColor, $opposite);
+ }
+
+ protected function _getAutoTextColor($base, $color, $opposite = false)
{
$darkColor = '#383838';
$lightColor = '#ffffff';
- if ($this->textColor == 'auto' || !$this->textColor) {
+ if ($color == 'auto' || !$color) {
// If auto mode, check between black and white which have the biggest distance (i.e. most contrast) with neutralColor
- $neutral = new \Cubist\Util\Graphics\Color($this->neutralColor);
+ $neutral = new \Cubist\Util\Graphics\Color($base);
$black = new \Cubist\Util\Graphics\Color($darkColor);
$white = new \Cubist\Util\Graphics\Color($lightColor);
$distBlack = $neutral->distance($black);
$res = $darkColor;
}
} else {
- $res = match ($this->textColor) {
+ $res = match ($color) {
'dark' => $darkColor,
'#000000' => $darkColor,
'#ffffff' => $lightColor,