use Cubist\Util\Files\VirtualDirectory;
use Cubist\Util\Graphics\Color;
use Cubist\Util\Text;
-use Illuminate\Translation\Translator;
-use Psy\Output\Theme;
use RyanChandler\Blade\Blade;
-use function PHPUnit\Framework\matches;
class QuizCompiler extends Base
{
// Fonts size:Line Height
$this->sassVariables['fonts-size'] = "(14: 20px, 16: 22px, 20: 28px, 24: 35px)";
+ // fill areas
+ $this->sassVariables['intro-fill-area'] = $this->theme->introColor ?: 'transparent';
+ $this->sassVariables['outro-fill-area'] = $this->theme->outroColor ?: 'transparent';
+ $this->sassVariables['standard-fill-area'] = $this->theme->standardColor ?: 'transparent';
+ $this->sassVariables['drangandrop-area1-fill-area'] = $this->theme->draganddropArea1Color ?: 'transparent';
+ $this->sassVariables['drangandrop-area2-fill-area'] = $this->theme->draganddropArea2Color ?: 'transparent';
+
// Main background
$this->sassVariables['background-color'] = Color::colorToCSS($this->theme->backgroundColor);
$this->sassVariables['background-custom'] = $this->theme->backgroundCustom ? 'true' : 'false';
protected function _escapeSassValue($value)
{
+ $value = trim($value);
+ if (str_starts_with($value, 'rgb')) {
+ return $value;
+ }
if (stristr($value, '.')) {
return '"' . $value . '"';
}
'nokColor' => (string)$quiz->nokColor,
'logo' => hash_file('sha256', $logo),
'banner' => hash_file('sha256', $banner),
+ 'overlay' => (string)$quiz->overlay,
];
$hash = hash('sha256', print_r($data, true));
$theme = QuizTheme::withoutGlobalScopes()->where('hash', $hash)->first();
return $theme->id;
}
+
$theme = new QuizTheme();
$theme->hash = $hash;
$theme->name = $quiz->client . ' - ' . $quiz->title;
$theme->mainColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->mainColor);
- $theme->neutralColor = \Cubist\Util\Graphics\Color::colorToCSS('#333333');
$theme->okColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->okColor);
$theme->nokColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->nokColor);
+ $theme->introColor = 'transparent';
+ $theme->outroColor = $theme->standardColor = $theme->draganddropArea1Color = $theme->draganddropArea2Color = \Cubist\Util\Graphics\Color::colorToCSS($quiz->overlay);
+ $theme->neutralColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->overlay);
$theme->backgroundColor = '#ffffff';
$theme->owner = 5;
$tmp = Files::tempnam() . '.jpg';
$blur = Files::tempnam() . '.jpg';
-
$resizer = new Resizer();
$resizer->loadImage($banner);
$resizer->resize(1200, 680, true, true);
Imagemagick::blur($tmp, $blur);
$theme->addMediaToField('backgroundImage', $blur);
+
+ $blur = Files::tempnam() . '.jpg';
$resizer = new Resizer();
$resizer->loadImage($banner);
$resizer->resize(390, 844, true, true);
$theme->backgroundHorizontalAlignMobile = HorizontalAlign::CENTER;
$theme->backgroundVerticalAlignMobile = VerticalAlign::MIDDLE;
- $theme->introCustom = '0';
-
$theme->save();
return $theme->id;
}