Add theme support with dynamic icons

This commit is contained in:
Jordan Wages 2025-07-08 01:30:37 -05:00
commit 7e64a428ac
5 changed files with 132 additions and 65 deletions

View file

@ -1,4 +1,10 @@
const aiLog = (await import(browser.runtime.getURL("logger.js"))).aiLog;
const storage = (globalThis.messenger ?? browser).storage;
const { theme } = await storage.local.get('theme');
const mode = (theme || 'auto') === 'auto'
? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
: theme;
document.documentElement.dataset.theme = mode;
const qMid = parseInt(new URLSearchParams(location.search).get("mid"), 10);
if (!isNaN(qMid)) {