Color Mode
Learn how to customize color mode.
Color Mode overview is here.
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.
Before running the following commands, you need to install@yamada-ui/cliand execute theinitcommand. For more details, please see here.pnpm yamada-cli themenpm yamada-cli themeyarn yamada-cli themebun yamada-cli theme - 2
Change the Config
Change the
config.tsin 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> ) }