storybookjs / addon-styling

A base addon for configuring popular styling tools
MIT License
44 stars 10 forks source link

[Question] Recommended way to change the Storybook theme too? #50

Closed sneko closed 1 year ago

sneko commented 1 year ago

Hi,

Since it's about managing themes I wonder what you recommend to change the Storybook theme?

There is a community initiative at https://github.com/hipstersmoothie/storybook-dark-mode , should I go with it or addon-styling plans to allow specifying Storybook ThemeVars objects too? (maybe I missed something)

Thank you,

ShaunEvening commented 1 year ago

Hey @sneko 👋

Good question! @storybook/addon-styling is designed to handle theme switching in the preview iframe, where your components are rendered.

If you're looking for something to toggle the theme of the manager ui like storybook-dark-mode does, I'd recommend using that. My concern with adding that functionality to @storybook/addon-styling is needing to keep track of two sets of themes and keep them in sync.

For what it's worth, as of Storybook 7.0 it recognizes your machine's ui preference and sets the light or dark mode for the manager ui accordingly. We should really add the ability to toggle that into Storybook itself.

I hope that helps!

sneko commented 1 year ago

I'm fine with using another plugin. Maybe it's missing an example to manage events but there are a lot of possibilities, does people want to use the addon-styling switcher to change, or the Storybook one to change addon-styling theme...

Closing as I'm fine with having both independent for now :)

Thank you,