import windowsContrastTheme from "./windows-contrast-theme.json" type WindowsContrastFile = { light: Record dark: Record } const file = windowsContrastTheme as WindowsContrastFile const WINDOWS_VAR_KEYS = new Set([ ...Object.keys(file.light), ...Object.keys(file.dark), ]) export function applyWindowsContrastTheme() { const el = document.documentElement const isDark = el.classList.contains("dark") const map = isDark ? file.dark : file.light for (const [prop, val] of Object.entries(map)) { el.style.setProperty(prop, val) } } export function clearWindowsContrastTheme() { const el = document.documentElement for (const key of WINDOWS_VAR_KEYS) { el.style.removeProperty(key) } }