feat: support css injection

This commit is contained in:
GyDi
2022-04-01 02:08:42 +08:00
parent 42c570a6e2
commit c93cbb614d
4 changed files with 20 additions and 6 deletions

View File

@@ -40,12 +40,25 @@ export default function useCustomTheme() {
},
},
typography: {
// todo
fontFamily: setting.font_family
? `"${setting.font_family}", ${dt.font_family}`
? `${setting.font_family}, ${dt.font_family}`
: dt.font_family,
},
});
// inject css
let style = document.querySelector("style#verge-theme");
if (!style) {
style = document.createElement("style");
style.id = "verge-theme";
document.head.appendChild(style!);
}
if (style) {
style.innerHTML = setting.css_injection || "";
}
// update svg icon
const { palette } = theme;
setTimeout(() => {