diff --git a/napcat.webui/index.html b/napcat.webui/index.html index 12511914..995dfcb2 100644 --- a/napcat.webui/index.html +++ b/napcat.webui/index.html @@ -13,7 +13,6 @@ content="viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> - diff --git a/napcat.webui/src/main.tsx b/napcat.webui/src/main.tsx index 0a549a81..ed4dfb93 100644 --- a/napcat.webui/src/main.tsx +++ b/napcat.webui/src/main.tsx @@ -22,6 +22,11 @@ if (theme && !theme.startsWith('"')) { localStorage.setItem(key.theme, JSON.stringify(theme)) } +const themeStyle = document.createElement('link') +themeStyle.rel = 'stylesheet' +themeStyle.href = '/files/theme.css' +document.head.appendChild(themeStyle) + ReactDOM.createRoot(document.getElementById('root')!).render( // diff --git a/src/webui/index.ts b/src/webui/index.ts index 2e35497f..a2e5c415 100644 --- a/src/webui/index.ts +++ b/src/webui/index.ts @@ -87,12 +87,12 @@ export async function InitWebUi(logger: LogWrapper, pathWrapper: NapCatPathWrapp // 生成css(分为亮色和暗色,靠class和[data-theme="light"]) let css = '.dark, [data-theme="dark"] {'; for (const key in colors.dark) { - css += `--${key}: ${colors.dark[key]};`; + css += `${key}: ${colors.dark[key]};`; } css += '}'; css += '.light, [data-theme="light"] {'; for (const key in colors.light) { - css += `--${key}: ${colors.light[key]};`; + css += `${key}: ${colors.light[key]};`; } css += '}';