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!

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.