0.3.0-alpha.0 • Published 2 years ago

@talves/itui-color-modes v0.3.0-alpha.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@talves/itui-color-modes

Adds support for user-controlled color modes

Note: This package is included in the main itui package, and generally should not be used on its own.

npm i @theme-ui/color-modes
import { createThemeProvider } from '@theme-ui/core'
import { createColorModeProvider } from '@theme-ui/color-modes'
import theme from './theme'

export default ({ children, IsolatedContext }) => {
  const { ThemeProvider } = createThemeProvider(
    IsolatedContext
  )
  const { ColorModeProvider } = createColorModeProvider(
    IsolatedContext
  )

  return (
    <ThemeProvider theme={theme}>
      <ColorModeProvider>
        {children}
      </ColorModeProvider>
    </ThemeProvider>
  )
}

API

  • InitializeColorMode
  • createColorModeProvider
    • useColorMode
    • ColorModeProvider