Set color mode colors via `theme.colors.modes`
See original GitHub issueIs it possible to use color mode like in theme-ui
:
colors: {
...chakraTheme.colors,
accent1: '#FAFAFA',
accent2: '#EAEAEA',
accent3: '#999',
accent4: '#888',
modes: {
dark: {
accent1: '#111',
accent2: '#333',
accent3: '#999',
accent4: '#FAFAFA',
},
},
},
_Originally posted by @arnaudjnn in https://github.com/chakra-ui/chakra-ui/issues/1147#issuecomment-656531188_
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Color Modes
Color Modes. Color modes can be used to create a user-configurable dark mode or any number of other color modes. Defining colors. In...
Read more >Colors and styling | Visualize and present data
Under Features, select Colors & Themes. Click on the Report Themes tab. Click on the New Theme button. Enter a name for your...
Read more >prefers-color-scheme - CSS: Cascading Style Sheets | MDN
The prefers-color-scheme CSS media feature is used to detect if a user has requested light or dark color themes.
Read more >Dark theme - Material Design
A dark theme displays dark surfaces across the majority of a UI. It's designed to be a supplemental mode to a default (or...
Read more >Color modes
For example, to change the color mode of a dropdown menu, add data-bs-theme="light" or data-bs-theme="dark" to the parent .dropdown . Now, no matter...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround for this kind of thing, I’ve created a Provider which sets the right colours directly onto the theme object by making a new
.mode
property available based on your theme config having a.modes.<light|dark>
key:Then use it like so:
So we have to use a condition each time we use color?
<Text bg="accent2"/>
is better than<Text bg={colorMode === "dark" ? "green.300" : "green.500"} />