MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / useThemeNormalized

Function useThemeNormalized

packages/web/src/hooks/useThemeNormalized.ts:6–22  ·  view source on GitHub ↗
(defaultTheme: "light" | "dark" = "light")

Source from the content-addressed store, hash-verified

4import { useMemo } from "react";
5
6export const useThemeNormalized = (defaultTheme: "light" | "dark" = "light") => {
7 const { theme: _theme, systemTheme, setTheme } = useThemeBase();
8
9 const theme = useMemo(() => {
10 if (_theme === "system") {
11 return systemTheme ?? defaultTheme;
12 }
13
14 return _theme ?? defaultTheme;
15 }, [_theme, systemTheme, defaultTheme]);
16
17 return {
18 theme,
19 systemTheme,
20 setTheme,
21 };
22}

Callers 1

useCodeMirrorThemeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected