Files
ROSzetta/frontend/src/utils/theme.ts
T
2026-05-17 20:54:53 +05:00

15 lines
585 B
TypeScript

// Применяет тему и язык к документу при загрузке/смене настроек.
export function applyTheme(theme: string | undefined) {
const id = theme && typeof theme === 'string' ? theme : 'mk-dark';
document.documentElement.setAttribute('data-theme', id);
}
export function applyLocale(locale: string | undefined) {
const id = locale && typeof locale === 'string' ? locale : 'ru';
document.documentElement.setAttribute('lang', id);
}
export function applyInstanceName(name: string | undefined) {
if (name) document.title = name;
}