mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 09:13:50 +02:00
refactor: custom fonts
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import {
|
||||
// changeAppDarkStyle,
|
||||
applyAppCjkFontPack,
|
||||
applyAppFontFamily,
|
||||
changeAppThemeStyle,
|
||||
changeHtmlLangAttribute,
|
||||
getThemeMode,
|
||||
initThemeColor,
|
||||
refreshCustomCss
|
||||
// setLoginContainerStyle
|
||||
} from '../shared/utils/base/ui';
|
||||
import {
|
||||
APP_CJK_FONT_PACK_DEFAULT_KEY,
|
||||
APP_FONT_DEFAULT_KEY
|
||||
} from '../shared/constants';
|
||||
import { i18n, loadLocalizedStrings } from './i18n';
|
||||
|
||||
import configRepository from '../services/config';
|
||||
@@ -22,9 +26,7 @@ export async function initUi() {
|
||||
await loadLocalizedStrings(language);
|
||||
changeHtmlLangAttribute(language);
|
||||
|
||||
const { initThemeMode, isDarkMode } =
|
||||
await getThemeMode(configRepository);
|
||||
// setLoginContainerStyle(isDarkMode);
|
||||
const { initThemeMode } = await getThemeMode(configRepository);
|
||||
changeAppThemeStyle(initThemeMode);
|
||||
await initThemeColor();
|
||||
} catch (error) {
|
||||
@@ -33,3 +35,30 @@ export async function initUi() {
|
||||
|
||||
refreshCustomCss();
|
||||
}
|
||||
|
||||
export async function initUiForVrOverlay() {
|
||||
try {
|
||||
const [language, fontFamily, customFontFamily, cjkFontPack] =
|
||||
await Promise.all([
|
||||
configRepository.getString('VRCX_appLanguage', 'en'),
|
||||
configRepository.getString(
|
||||
'VRCX_fontFamily',
|
||||
APP_FONT_DEFAULT_KEY
|
||||
),
|
||||
configRepository.getString('VRCX_customFontFamily', ''),
|
||||
configRepository.getString(
|
||||
'VRCX_cjkFontPack',
|
||||
APP_CJK_FONT_PACK_DEFAULT_KEY
|
||||
)
|
||||
]);
|
||||
|
||||
// @ts-ignore
|
||||
i18n.locale = language;
|
||||
await loadLocalizedStrings(language);
|
||||
changeHtmlLangAttribute(language);
|
||||
applyAppFontFamily(fontFamily, customFontFamily);
|
||||
applyAppCjkFontPack(cjkFontPack);
|
||||
} catch (error) {
|
||||
console.error('Error initializing VR locale and fonts:', error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user