Open History to see the last commit
1import { createContext, useContext } from 'solid-js'
2import type { Accessor } from 'solid-js'
3β
4export const ThemeContext = createContext<Accessor<'light' | 'dark'>>(
5 () => 'dark' as const,
6)
7β
8/**
9 * Returns the devtools theme from context.
10 *
11 * @returns A getter for the current theme, `'light'` or `'dark'`. Defaults to
12 * `'dark'`.
13 */
14export function useTheme() {
15 return useContext(ThemeContext)
16}