storybook-dark-mode
storybook-dark-mode copied to clipboard
How to do story integration in the case of `storybook/html`, no React or Theme?
The core functionality of toggling dark mode works great, thanks!
For story integration, the current README
assumes CSS and React: it hinges on custom theme providers and the code example shows a React component that gets notified via a hook.
It would be great if stories knew if the current mode is light or dark mode, for example, as if it were a knob, irrespective of how the story responds (it may not be CSS - it may be a Canvas2d
redraw) and what framework one is using (eg. none). Is it supported?
Would #101 work for you (dark/light class on the preview iframe <body>
)?
I think it should solve this
It does assume css though
There are two ways to accomplish this
- stylePreview option (Thanks @jpzwarte!)
-
Subscribing to the
DARK_MODE
event
Does the events API satisfy your needs?
stylePreview seems to not be working
PRs welcome!