@crossed/styled
Version:
A universal & performant styling library for React Native, Next.js & React
18 lines (15 loc) • 500 B
text/typescript
/**
* Copyright (c) Paymium.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root of this projects source tree.
*/
import type { SetTheme } from './types';
export const setTheme: SetTheme = (old, theme) => {
if (typeof window !== 'undefined') {
if (!window.document.documentElement.classList.contains(theme)) {
window.document.documentElement.classList.remove(old);
window.document.documentElement.classList.add(theme);
}
}
};