From f2375b616222563741a088e550cef3a29fcaff57 Mon Sep 17 00:00:00 2001
From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr>
Date: Tue, 14 Jan 2025 19:27:27 +0100
Subject: [PATCH] Use theme css variable in survey

---
 macao/assets/quiz.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/macao/assets/quiz.js b/macao/assets/quiz.js
index c1e4527..4569e11 100644
--- a/macao/assets/quiz.js
+++ b/macao/assets/quiz.js
@@ -106,8 +106,15 @@ $(function () {
         innerCss: "sd-btn nav-input"
     });
 
+    // Ugly tricks to avoid to create a new theme
+    const customTheme = SurveyTheme.DefaultLightPanelless;
+    const primColor = getComputedStyle(document.documentElement,null).getPropertyValue('--macao-primary-color');
+
+    customTheme.cssVariables["--sjs-primary-backcolor"] = primColor;
+    customTheme.cssVariables["--sjs-primary-backcolor-dark"] = primColor;
     // Apply theme
     survey.applyTheme(SurveyTheme.DefaultLightPanelless);
+    console.log("Survey theme applied", SurveyTheme.DefaultLightPanelless);
 
     // Inflate the survey in the page
     $("#surveyContainer").Survey({ model: survey });
-- 
GitLab