diff --git a/extension/popup/popup.html b/extension/popup/popup.html index 9fdbef7..dcbf7ac 100644 --- a/extension/popup/popup.html +++ b/extension/popup/popup.html @@ -17,10 +17,12 @@ Curate
- - +
diff --git a/extension/popup/popup.js b/extension/popup/popup.js index fefc495..ae83383 100644 --- a/extension/popup/popup.js +++ b/extension/popup/popup.js @@ -164,7 +164,7 @@ function bookmarkRowHtml(bookmark) {
- +
`; } @@ -195,7 +195,7 @@ function renderCollections(collections) { ${count} bookmark${count === 1 ? '' : 's'} ${collection.description ? `${escapeHtml(collection.description)}` : ''} - + `; collectionList.appendChild(item); }); @@ -660,10 +660,24 @@ deleteForm.addEventListener('submit', async (event) => { } }); +function applyThemeToggleState(theme) { + const toggle = $('#theme-toggle'); + if (!toggle) return; + const nextTheme = theme === 'dark' ? 'light' : 'dark'; + const label = `Switch to ${nextTheme} theme`; + toggle.setAttribute('aria-label', label); + toggle.setAttribute('title', label); +} + +function applyTheme(theme) { + document.documentElement.setAttribute('data-theme', theme); + applyThemeToggleState(theme); +} + $('#theme-toggle').addEventListener('click', async () => { const current = document.documentElement.getAttribute('data-theme') || 'light'; const next = current === 'dark' ? 'light' : 'dark'; - document.documentElement.setAttribute('data-theme', next); + applyTheme(next); await setTheme(next); }); @@ -690,7 +704,7 @@ document.querySelectorAll('.password-toggle').forEach((btn) => { async function initTheme() { const theme = await getTheme(); - document.documentElement.setAttribute('data-theme', theme); + applyTheme(theme); const forgotLink = $('#forgot-password-link'); if (forgotLink) { forgotLink.href = `${await getApiBaseUrl()}/forgot-password`;