カラーモード
カラーモードをカスタマイズする方法を学ぶ。
カラーモードの概要はこちらをご覧ください。
カスタマイズ
デフォルトでは、カラーモードは"light"が設定されています。もし、"dark"または"system"を使用する場合は、config.defaultColorModeに値を設定します。
- 1
- 2
コンフィグを変更する
生成したテーマの
config.tsを変更します。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
プロバイダーを更新する
生成したテーマを
UIProviderに設定します。import { UIProvider } from "@workspaces/ui" import { theme, config } from "@workspace/theme" const App = () => { return ( <UIProvider theme={theme} config={config}> <YourApplication /> </UIProvider> ) }