diff --git a/pom.xml b/pom.xml
index 5568023..a4507e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,6 +58,10 @@
1.24.8
true
+
+ org.jenkins-ci.plugins
+ jackson2-api
+
io.jenkins
configuration-as-code
diff --git a/src/main/java/io/jenkins/plugins/thememanager/Theme.java b/src/main/java/io/jenkins/plugins/thememanager/Theme.java
index 66e45d3..a1e51ce 100644
--- a/src/main/java/io/jenkins/plugins/thememanager/Theme.java
+++ b/src/main/java/io/jenkins/plugins/thememanager/Theme.java
@@ -3,6 +3,7 @@
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.HashSet;
@@ -22,6 +23,11 @@
public class Theme {
private static final String JS_HTML = "";
+ private static final String JSON_HTML =
+ "";
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
private static final String CSS_HTML =
"";
@@ -55,6 +61,14 @@ Set generateHeaderElements(boolean injectCss) {
headerElements.add(MessageFormat.format(JS_HTML, javascriptUrl));
}
+ try {
+ headerElements.add(
+ MessageFormat.format(
+ JSON_HTML, "properties", OBJECT_MAPPER.writeValueAsString(properties)));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
return headerElements;
}
diff --git a/src/main/resources/io/jenkins/plugins/thememanager/ThemeManagerPageDecorator/header.jelly b/src/main/resources/io/jenkins/plugins/thememanager/ThemeManagerPageDecorator/header.jelly
index 9c7f12d..4fb2951 100644
--- a/src/main/resources/io/jenkins/plugins/thememanager/ThemeManagerPageDecorator/header.jelly
+++ b/src/main/resources/io/jenkins/plugins/thememanager/ThemeManagerPageDecorator/header.jelly
@@ -1,6 +1,6 @@
-
${it.getHeaderHtml()}
+
diff --git a/src/main/resources/io/jenkins/plugins/thememanager/header/main.js b/src/main/resources/io/jenkins/plugins/thememanager/header/main.js
index 9f87ae0..95af83e 100644
--- a/src/main/resources/io/jenkins/plugins/thememanager/header/main.js
+++ b/src/main/resources/io/jenkins/plugins/thememanager/header/main.js
@@ -3,4 +3,13 @@ const theme = JSON.parse(themeJson);
if (theme.id && theme.id !== '') {
document.documentElement.dataset.theme = theme.id
-}
\ No newline at end of file
+}
+
+
+const propertiesJson = document.getElementById('theme-manager-properties').text
+const parsedProperties = JSON.parse(propertiesJson);
+
+Object.entries(parsedProperties)
+ .forEach((obj) => document.documentElement.dataset[obj[0]
+ .replace(/[-:]/g, '_')
+ ] = obj[1]);