Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

theme.tsx

31 lines699 Bytes

1import React from 'react'
2​
3export const defaultTheme = {
4 background: '#0b1521',
5 backgroundAlt: '#132337',
6 foreground: 'white',
7 gray: '#3f4e60',
8 grayAlt: '#222e3e',
9 inputBackgroundColor: '#fff',
10 inputTextColor: '#000',
11 success: '#00ab52',
12 danger: '#ff0085',
13 active: '#006bff',
14 warning: '#ffb200',
15} as const
16​
17export type Theme = typeof defaultTheme
18interface ProviderProps {
19 theme: Theme
20 children?: React.ReactNode
22​
23const ThemeContext = React.createContext(defaultTheme)
24​
25export function ThemeProvider({ theme, ...rest }: ProviderProps) {
26 return <ThemeContext.Provider value={theme} {...rest} />
28​
29export function useTheme() {
30 return React.useContext(ThemeContext)