|
7 | 7 | const clientId = |
8 | 8 | globalThis.crypto?.randomUUID?.() || |
9 | 9 | `bc-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`; |
10 | | - const desiredModes = { fish: false, muted: true, tone: "dark" }; |
| 10 | + const desiredModes = { fish: false, muted: true, tone: "auto" }; |
11 | 11 | let activePayload = null; |
12 | 12 | let playbackBlocked = false; |
13 | 13 | const systemDarkMedia = globalThis.matchMedia?.("(prefers-color-scheme: dark)") ?? null; |
@@ -59,31 +59,30 @@ html[data-bc-fish="true"] #beauticode-bg-stage::after{background:transparent!imp |
59 | 59 | #beauticode-bg-stage img{z-index:0} |
60 | 60 | #beauticode-bg-stage video{z-index:1} |
61 | 61 | html[data-bc-active="true"] #root{position:relative;z-index:1;background:transparent!important} |
| 62 | +html[data-bc-active="true"] [class*="_fade"]{display:none!important} |
62 | 63 | html[data-bc-fish="true"] #root{opacity:0!important;visibility:hidden!important;pointer-events:none!important} |
63 | 64 | `; |
64 | 65 | document.head.append(style); |
65 | 66 |
|
66 | | - function resolvedTone() { |
67 | | - if (desiredModes.tone !== "auto") return desiredModes.tone; |
| 67 | + function dshAppearance() { |
| 68 | + const body = document.body; |
| 69 | + if (body?.hasAttribute("data-ds-dark-theme")) return "dark"; |
| 70 | + const scheme = document.documentElement.style.colorScheme; |
| 71 | + if (scheme === "dark" || scheme === "light") return scheme; |
68 | 72 | return systemDarkMedia?.matches ? "dark" : "light"; |
69 | 73 | } |
70 | 74 |
|
| 75 | + function resolvedTone() { |
| 76 | + return dshAppearance(); |
| 77 | + } |
| 78 | + |
71 | 79 | function isDshThemeSynced(tone = resolvedTone()) { |
72 | | - const body = document.body; |
73 | | - if (!body) return false; |
74 | | - return ( |
75 | | - body.hasAttribute("data-ds-dark-theme") === (tone === "dark") && |
76 | | - document.documentElement.style.colorScheme === tone |
77 | | - ); |
| 80 | + return document.documentElement.dataset.bcResolvedTone === tone; |
78 | 81 | } |
79 | 82 |
|
80 | 83 | function syncDshTheme() { |
81 | 84 | const tone = resolvedTone(); |
82 | | - const root = document.documentElement; |
83 | | - const body = document.body; |
84 | | - root.dataset.bcResolvedTone = tone; |
85 | | - if (root.style.colorScheme !== tone) root.style.colorScheme = tone; |
86 | | - if (body) body.toggleAttribute("data-ds-dark-theme", tone === "dark"); |
| 85 | + document.documentElement.dataset.bcResolvedTone = tone; |
87 | 86 | return isDshThemeSynced(tone); |
88 | 87 | } |
89 | 88 |
|
|
0 commit comments