Skip to content

Commit d900e3c

Browse files
committed
fix(ui): theme color in safari
1 parent d596943 commit d900e3c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/lib/stores.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,16 @@ mw: 600
100100
- \`\`\`showMenu: false\`\`\` \\ to hide the menu
101101
`);
102102

103-
// Theme store implementation (unchanged)
104103
function createThemeStore() {
105104
const { subscribe, set, update } = writable("light");
106105

107106
function updateBrowserTheme(theme) {
108107
if (typeof window === "undefined") return;
109108
const themeColor = theme === "dark" ? "#1a1a1a" : "#FCFCF9";
110-
const metaTags = document.querySelectorAll('meta[name="theme-color"]');
111-
metaTags.forEach((tag) => {
112-
if (
113-
(theme === "light" && tag.media === "(prefers-color-scheme: light)") ||
114-
(theme === "dark" && tag.media === "(prefers-color-scheme: dark)") ||
115-
!tag.media
116-
) {
117-
tag.setAttribute("content", themeColor);
118-
}
119-
});
109+
const metaTag = document.querySelector('meta[name="theme-color"]');
110+
if (metaTag) {
111+
metaTag.setAttribute("content", themeColor);
112+
}
120113
}
121114

122115
if (typeof window !== "undefined") {

0 commit comments

Comments
 (0)