Set default theme on load

Hi all

I would like to set the default load theme (e.g. dark, light), without having to navigate to the hamburger after loading.

Sometimes the app “remembers” to load dark/light however is there a more consistent way to set this? Thanks

1 Like

Hi @littlefield,

You can add theme configuration parameters to a config.toml file and that will enable the app to load automatically with that configuration, for example:

primaryColor = "F36295"
backgroundColor = "#F0FF33"
secondaryBackgroundColor = "#3183D1"
textColor = "#03080C"
font = "sans-serif"

Check out our theme documentation here.

Best,

Caroline

Also, if you just want to set light or dark theme as a default for the viewer, you can write

[theme]
base = "light"

or

[theme]
base = "dark"

into .streamlit/config.toml. See also here.

2 Likes