Color Mode

Learn how to customize color mode.

Customize

By default, the color mode is set to "light". If you want to use "dark" or "system", set the value to config.defaultColorMode.

  • 1

    Generate a Theme

    Use the CLI to generate a theme.

    pnpm yamada-cli theme
    
  • 2

    Change the Config

    Change the config.ts in the generated theme.

    theme/config.ts

    import { defineConfig } from "@yamada-ui/react"
    
    export const config = defineConfig({
      css: { varPrefix: "ui" },
      breakpoint: { direction: "down", identifier: "@media screen" },
      defaultColorMode: "dark", 
      defaultThemeScheme: "base",
      notice: { duration: 5000 },
      theme: { responsive: true },
    })
    
  • 3

    Update the Provider

    Set the generated theme to UIProvider.

    import { UIProvider } from "@workspaces/ui"
    import { theme, config } from "@workspace/theme"
    
    const App = () => {
      return (
        <UIProvider theme={theme} config={config}>
          <YourApplication />
        </UIProvider>
      )
    }