Replies: 1 comment
-
Ok, so I have done the following in const isDarkThemePreferred2 = globalThis
? globalThis.matchMedia('(prefers-color-scheme: dark)').matches
: false; Then in the preview section of the file, I update the default to call that function and set the default based on CSS pref: backgrounds: {
default: isDarkThemePreferred2 ? 'Dark Mode' : 'Light Mode',
values: [
{
name: 'Light Mode',
value: 'rgb(246 246 250)',
},
{
name: 'Dark Mode',
value: 'rgb(26 29 45)',
},
],
}, Is there a better way to do this or do I have the best way to do this for now? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
When my system is set to dark mode the main story body is white. Is there a way to switch the theme to dark do the background changes?
Additional information
Storybook version: 8.0.9
Main ts
I was wondering, I can get the users preference in
preview.tsx
but not sure if there is a way I can set it?Create a reproduction
https://github.com/jrock2004/component-library
Beta Was this translation helpful? Give feedback.
All reactions