mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 14:04:21 +01:00
23 lines
477 B
TypeScript
23 lines
477 B
TypeScript
import { createEffect, onCleanup } from 'solid-js';
|
|
|
|
import useConfig from '@/core/useConfig';
|
|
|
|
export const useColorTheme = (el: HTMLElement) => {
|
|
const { getColorTheme } = useConfig();
|
|
|
|
createEffect(() => {
|
|
const colorTheme = getColorTheme();
|
|
|
|
const { className } = colorTheme;
|
|
if (className != null) {
|
|
el.classList.add(className);
|
|
|
|
onCleanup(() => {
|
|
el.classList.remove(className);
|
|
});
|
|
}
|
|
});
|
|
};
|
|
|
|
export default useColorTheme;
|