diff --git a/background.js b/background.js index fcccc6b..9084c8c 100644 --- a/background.js +++ b/background.js @@ -377,6 +377,19 @@ async function clearCacheForMessages(idsInput) { refreshMenuIcons(); } }); + + if (browser.theme?.onUpdated) { + browser.theme.onUpdated.addListener(async () => { + if (userTheme === 'auto') { + const theme = await detectSystemTheme(); + if (theme !== currentTheme) { + currentTheme = theme; + updateActionIcon(); + refreshMenuIcons(); + } + } + }); + } } catch (err) { logger.aiLog("failed to load config", { level: 'error' }, err); } diff --git a/manifest.json b/manifest.json index d44fd1d..0cbfb13 100644 --- a/manifest.json +++ b/manifest.json @@ -41,6 +41,7 @@ "accountsRead", "menus", "scripting", - "tabs" + "tabs", + "theme" ] }