feat: color themes

This commit is contained in:
Shusui MOYATANI
2024-01-06 18:02:50 +09:00
parent e36176c8cb
commit 357e337f66
44 changed files with 459 additions and 215 deletions

View File

@@ -0,0 +1,23 @@
import { createEffect, onCleanup } from 'solid-js';
import useConfig from '@/core/useConfig';
export const useColorTheme = (el: HTMLElement) => {
const { getColorTheme } = useConfig();
createEffect(() => {
const colorTheme = getColorTheme();
if (colorTheme == null) return;
const { className } = colorTheme;
if (className != null) {
el.classList.add(className);
onCleanup(() => {
el.classList.remove(className);
});
}
});
};
export default useColorTheme;