From 2e07251c0603b32786fcab7216a9ee05db988239 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Tue, 29 Oct 2024 21:31:48 -0700 Subject: [PATCH] Complete theme toggle. Adjust theme colors (needs some more tweaking). --- app/pages/nemo-wallet.html | 162 +++++++++++++++++++++++++------------ 1 file changed, 110 insertions(+), 52 deletions(-) diff --git a/app/pages/nemo-wallet.html b/app/pages/nemo-wallet.html index ac5b420..d460010 100644 --- a/app/pages/nemo-wallet.html +++ b/app/pages/nemo-wallet.html @@ -60,14 +60,17 @@ }) } } - const clearStorageButton = document.querySelector('#clear-storage-button') + const themeCheckbox = document.getElementById('theme-checkbox') + themeCheckbox.addEventListener('change', selectTheme) + selectTheme() + const clearStorageButton = document.getElementById('clear-storage-button') clearStorageButton.addEventListener('click', (event) => { if (event.detail === 1) { clearStorage() } }) setTimeout(() => { - document.getElementsByTagName('body')[0].style.visibility = 'visible' + document.body.style.visibility = 'visible' }, 250) console.log('loaded ui') } @@ -451,29 +454,17 @@ notify.ok(`Session storage cleared`) btn.removeAttribute('disabled') } - // function toggleTheme () { - // const body = document.querySelector('body') - // const theme = body.style.getPropertyValue('--theme') - // switch (theme) { - // case dark: { - // body.style = { - // "--theme": "light", - // "--theme-primary": "var(--color-light)", - // "--theme-secondary": "var(--color-blue)", - // "--theme-highlight": "var(--color-dark)", - // "--theme-text": "var(--color-black)" - // break - // } - // case light: { - // body.style = { - // "--theme": "light", - // "--theme-primary": "var(--color-light)", - // "--theme-secondary": "var(--color-blue)", - // "--theme-highlight": "var(--color-dark)", - // "--theme-text": "var(--color-black)" - // break - // } - // } + function selectTheme () { + const body = document.querySelector('body') + const themeCheckbox = document.getElementById('theme-checkbox') + if (themeCheckbox.checked) { + body.style = '--theme:dark;--theme-primary:var(--color-dark);--theme-secondary:var(--color-gray);--theme-highlight:var(--color-blue);--theme-content:var(--color-light);' + themeCheckbox.value = 'dark' + } else { + body.style = '--theme:light;--theme-primary:var(--color-light);--theme-secondary:var(--color-gray);--theme-highlight:var(--color-blue);--theme-content:var(--color-dark);' + themeCheckbox.value = 'light' + } + } - +
@@ -899,10 +951,16 @@
-

Settings

- + +

Settings

+ +
+ +
+ +

Licenses

-- 2.34.1