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

theme.tsx

32 lines725 Bytes

1import * as 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 paused: '#8c49eb',
15 warning: '#ffb200',
16} as const
17​
18export type Theme = typeof defaultTheme
19interface ProviderProps {
20 theme: Theme
21 children?: React.ReactNode
23​
24const ThemeContext = React.createContext(defaultTheme)
25​
26export function ThemeProvider({ theme, ...rest }: ProviderProps) {
27 return <ThemeContext.Provider value={theme} {...rest} />
29​
30export function useTheme() {
31 return React.useContext(ThemeContext)