From 0f2124db32606020766d237ce774a3c2e7783ee3 Mon Sep 17 00:00:00 2001 From: adamelmore <2363879+adamdottv@users.noreply.github.com> Date: Fri, 9 Jan 2026 11:57:27 -0600 Subject: fix(app): no inline js --- packages/app/public/oc-theme-preload.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/app/public/oc-theme-preload.js (limited to 'packages/app/public') diff --git a/packages/app/public/oc-theme-preload.js b/packages/app/public/oc-theme-preload.js new file mode 100644 index 000000000..f8c710496 --- /dev/null +++ b/packages/app/public/oc-theme-preload.js @@ -0,0 +1,28 @@ +;(function () { + var themeId = localStorage.getItem("opencode-theme-id") + if (!themeId) return + + var scheme = localStorage.getItem("opencode-color-scheme") || "system" + var isDark = scheme === "dark" || (scheme === "system" && matchMedia("(prefers-color-scheme: dark)").matches) + var mode = isDark ? "dark" : "light" + + document.documentElement.dataset.theme = themeId + document.documentElement.dataset.colorScheme = mode + + if (themeId === "oc-1") return + + var css = localStorage.getItem("opencode-theme-css-" + themeId + "-" + mode) + if (css) { + var style = document.createElement("style") + style.id = "oc-theme-preload" + style.textContent = + ":root{color-scheme:" + + mode + + ";--text-mix-blend-mode:" + + (isDark ? "plus-lighter" : "multiply") + + ";" + + css + + "}" + document.head.appendChild(style) + } +})() -- cgit v1.2.3