MCPcopy Index your code
hub / github.com/github/docs / useTheme

Function useTheme

components/hooks/useTheme.ts:101–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99}
100
101export function useTheme() {
102 const [theme, setTheme] = useState<ColorModeThemes>({
103 css: defaultCSSTheme,
104 component: defaultComponentTheme,
105 })
106
107 useEffect(() => {
108 const cookieValue = Cookies.get('color_mode')
109 const css = getCssTheme(cookieValue)
110 const component = getComponentTheme(cookieValue)
111 setTheme({ css, component })
112 }, [])
113
114 return { theme }
115}

Callers 3

MyAppFunction · 0.90
ArticleMarkdownFunction · 0.85
useBreakpointFunction · 0.85

Calls 2

getCssThemeFunction · 0.85
getComponentThemeFunction · 0.85

Tested by

no test coverage detected