forked from XiaoMo/ChatGPT-Next-Web
fix: the theme-color selector
This commit is contained in:
parent
377579e802
commit
170936a96e
@ -64,17 +64,17 @@ export function useSwitchTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const metaDescriptionDark = document.querySelector(
|
const metaDescriptionDark = document.querySelector(
|
||||||
'meta[name="theme-color"][media]',
|
'meta[name="theme-color"][media*="dark"]',
|
||||||
);
|
);
|
||||||
const metaDescriptionLight = document.querySelector(
|
const metaDescriptionLight = document.querySelector(
|
||||||
'meta[name="theme-color"]:not([media])',
|
'meta[name="theme-color"][media*="light"]',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (config.theme === "auto") {
|
if (config.theme === "auto") {
|
||||||
metaDescriptionDark?.setAttribute("content", "#151515");
|
metaDescriptionDark?.setAttribute("content", "#151515");
|
||||||
metaDescriptionLight?.setAttribute("content", "#fafafa");
|
metaDescriptionLight?.setAttribute("content", "#fafafa");
|
||||||
} else {
|
} else {
|
||||||
const themeColor = getCSSVar("--themeColor");
|
const themeColor = getCSSVar("--theme-color");
|
||||||
metaDescriptionDark?.setAttribute("content", themeColor);
|
metaDescriptionDark?.setAttribute("content", themeColor);
|
||||||
metaDescriptionLight?.setAttribute("content", themeColor);
|
metaDescriptionLight?.setAttribute("content", themeColor);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user