Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Add a guide for setting dark mode by default #34839

Merged
merged 22 commits into from
Nov 7, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/data/joy/guides/applying-dark-mode/applying-dark-mode.md
Expand Up @@ -105,3 +105,17 @@ export function onRenderBody({ setPreBodyComponents }) {
setPreBodyComponents([getInitColorSchemeScript()]);
}
```

## Dark mode by default

To have dark mode as the default theme of your app, set `defaultMode: 'dark'`.

```js
<CssVarsProvider defaultMode="dark">...</CssVarsProvider>
```

For server-side applications, provide the same value to `getInitColorSchemeScript`.

```js
getInitColorSchemeScript({ defaultMode: 'dark' });
```