Files
goldenChart/frontend/src/utils/documentTheme.ts
T
2026-05-23 21:25:46 +09:00

12 lines
465 B
TypeScript

import type { Theme } from '../types';
const HTML_THEME_CLASSES = ['theme-dark', 'theme-light', 'theme-blue'] as const;
/** body 포털(알림 팝업 등)에서도 테마 CSS 변수가 적용되도록 html 클래스 동기화 */
export function syncDocumentTheme(theme: Theme): void {
if (typeof document === 'undefined') return;
const html = document.documentElement;
html.classList.remove(...HTML_THEME_CLASSES);
html.classList.add(`theme-${theme}`);
}