mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 05:43:51 +02:00
fix fonts error
This commit is contained in:
@@ -26,6 +26,28 @@ function changeAppDarkStyle(isDark) {
|
||||
}
|
||||
}
|
||||
|
||||
function applyThemeFonts(themeKey, fontLinks = []) {
|
||||
document
|
||||
.querySelectorAll('link[data-theme-font]')
|
||||
.forEach((linkEl) => linkEl.remove());
|
||||
|
||||
if (!fontLinks?.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const head = document.head;
|
||||
fontLinks.forEach((href) => {
|
||||
if (!href) {
|
||||
return;
|
||||
}
|
||||
const fontLink = document.createElement('link');
|
||||
fontLink.rel = 'stylesheet';
|
||||
fontLink.href = href;
|
||||
fontLink.dataset.themeFont = themeKey;
|
||||
head.appendChild(fontLink);
|
||||
});
|
||||
}
|
||||
|
||||
function changeAppThemeStyle(themeMode) {
|
||||
if (themeMode === 'system') {
|
||||
themeMode = systemIsDarkMode() ? 'dark' : 'light';
|
||||
@@ -57,6 +79,8 @@ function changeAppThemeStyle(themeMode) {
|
||||
}
|
||||
$appThemeStyle.href = themeConfig.cssFile ? themeConfig.cssFile : '';
|
||||
|
||||
applyThemeFonts(themeMode, themeConfig.fontLinks);
|
||||
|
||||
if (themeConfig.isDark) {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user