]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6542 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 1 Dec 2023 16:47:37 +0000 (17:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 1 Dec 2023 16:47:37 +0000 (17:47 +0100)
app/Http/Controllers/Admin/Operations/Quiz/PreviewOperation.php

index 771daf8f2f0ef24c51a195a269ab9a1e25dd34e2..d26f2802905a76c8370791d219deb0de9b2877cd 100644 (file)
@@ -8,6 +8,7 @@ use App\Models\FluidbookTheme;
 use App\Models\Quiz;
 use App\Models\QuizTheme;
 use Cubist\Util\Files\Files;
+use Cubist\Util\Graphics\Color;
 use Cubist\Util\PHP;
 use Illuminate\Support\Facades\Route;
 
@@ -96,11 +97,15 @@ trait PreviewOperation
         if (null === $theme || null === $quiz) {
             abort(404);
         }
+
+        $back = $theme->backgroundColor;
+        $text = (new Color($back))->closestColor([(new Color('#000000')), (new Color('#ffffff'))], true)->toCss();
+
         $res = $this->_compileScreen(
             $quiz->title, $url, __('Compilation du quiz en cours'),
             __('Cette étape ne sera pas nécessaire lorsque le fluidbook sera installé sur son emplacement définitif'),
-            $theme->backgroundColor,
-            $theme->getTextsColor(),
+            $back,
+            $text,
         );
         return response($res);
     }