How to disable dark theme option?

Hello. Iā€™m developing an app using plotly, and am having a very hard time making things work with both light and dark themes. I canā€™t get the plotly plots to look good in dark theme. I therefore would like to disable the dark theme option, and enforce that the app only uses the light theme. How can this be done? I have tried everything that I can think of and canā€™t seem to do it. The dark theme option is always there. Anyone know how to restrict the theme?

Alternatively, does anyone have any suggestions on how to make a plotly plot work well with both light and dark themes? I donā€™t want to use any of the default plotly themes because I donā€™t think any of them look particularly good, and I canā€™t get my plot customizations to work with them.

Thanks!

1 Like

It might be sufficient if I can force the plotly plot to not change itā€™s them if the streamlit theme changes.

Hi @jrollins,

Thereā€™s not currently a way to disable Dark mode completely in a streamlit app. In a soon-to-come release, weā€™ll be providing a way to make Light/Dark the preset theme on app load, but there are currently no plans to let the option be totally disable-able.

I believe you should be able to set plotly chart colors regardless of the streamlit theme by passing a layout kwarg to st.plotly_chart and setting things in the chart according to the javascript layout API reference. The python dicts get converted to JSON objects more or less how youā€™d expect things to work. These should eventually get plumbed to the frontend and overwrite any theming defaults set by streamlit.

Ideally, though, weā€™d want st.plotly_chart to look good in dark mode so that this isnā€™t necessary. Feel free to file a GitHub issue with feedback on the current styling thatā€™s used and how it could be improved.

Hi,

Any update on being able to set a theme preset (e.g. set to light) upon app load?

Thanks!

I would love to see this as well

Hi @LostGoatOnHill, @kareemrasheed89,

This can currently be done by defining a ā€œcustom themeā€ in your config.toml file:

[theme]
base="light"

Streamlit will still respect the userā€™s settings if they manually override the theme of the app to light/dark mode, and the theme option in the settings menu will appear as ā€œCustom Themeā€, but doing this effectively sets the theme preset to light, even if the userā€™s OS settings would cause the theme to default to dark mode.

Thanks for this help. I am doing that already