Changing the Streamlit Theme with a Toggle Button

Hello, everybody.

I know how to change the theme using the config.toml file, but does anyone know a way to change the theme with the toggle of a button? Or perhaps change the config.toml file while the app is running?

I am aware that I can customize it with CSS, but the issue lies in changing the primary color for all classes, buttons, and other elements.

I have already tried various approaches and found an app that does exactly what I want, but I found it to be overly complicated with many functionalities that I don’t need. I only require a button, select box, or any similar element to switch between light and dark mode.

Thank you!

Hey @ViniciusStanula,

Unfortunately, changing the theme programmatically isn’t currently supported, but there is an open GitHub Issue for this enhancement request here – please upvote it/share your thoughts in the thread so our team can prioritize it accordingly. Thank you!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.