about summary refs log tree commit diff
path: root/src/state/models/ui/shell.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-08-22 13:04:17 -0500
committerGitHub <noreply@github.com>2023-08-22 11:04:17 -0700
commit548ec6c82d114f96c431a4e0f162e8360bfd22f4 (patch)
tree6089f1d3c87692ea1cb146d12a7c7506ae85362f /src/state/models/ui/shell.ts
parent16b265a86164e682486a3d8fa51bfa18d51bb945 (diff)
downloadvoidsky-548ec6c82d114f96c431a4e0f162e8360bfd22f4.tar.zst
add title attr to text text links (#1228)
* add title attr to text text links

* Revert "add title attr to text text links"

This reverts commit c028cd184efd3b2788d8f46134eecf521e5d7b07.

* use css tooltips

* add to expanded post state

* handle theming

* add to bskyweb
Diffstat (limited to 'src/state/models/ui/shell.ts')
-rw-r--r--src/state/models/ui/shell.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts
index d1ea4ddf1..0c0bb01d7 100644
--- a/src/state/models/ui/shell.ts
+++ b/src/state/models/ui/shell.ts
@@ -267,13 +267,20 @@ export class ShellUiModel {
   hydrate(v: unknown) {
     if (isObj(v)) {
       if (hasProp(v, 'colorMode') && isColorMode(v.colorMode)) {
-        this.colorMode = v.colorMode
+        this.setColorMode(v.colorMode)
       }
     }
   }
 
   setColorMode(mode: ColorMode) {
     this.colorMode = mode
+
+    if (typeof window !== 'undefined') {
+      const html = window.document.documentElement
+      // remove any other color mode classes
+      html.className = html.className.replace(/colorMode--\w+/g, '')
+      html.classList.add(`colorMode--${mode}`)
+    }
   }
 
   setMinimalShellMode(v: boolean) {