Setting a Streamlit Theme

Hey! im having issues trying to set a streamlit theme, when i make a file at .streamlit/config.toml and enter this:

font=“sans serif”

nothing changes(one time i did get an error, “theme.primaryColor” is not defined.), plus when i go to the menu and then to settings i cannot see a theming option, do i need to enable something somewhere?

In your code of config.toml file, you have wrong type of quotes in the last line (sans serif). I have changed them to normal("") and was able to reproduce your theme.

ah, thank you!

i still get this error AssertionError: Key “theme.primaryColor” is not defined. I think it is something to do with the actual setup i have, am i meant to have lots of lines in my config.toml(ie. other sections) too?

Hi @Epicfaze44, could you check if you’re running Streamlit version 0.79? That error gets thrown when you try to define a config option that doesn’t exist, and I’m not sure how that could be happening aside from the case where you’re not upgraded to the most recent version.

im on 0.78 :stuck_out_tongue: haha i guess i will need to upgrade

Hi, I upgraded to 0.79 but the error stays the same

AssertionError: Key “theme.primaryColor” is not defined.

My config is


port = 4200


serverAddress = "localhost"


font="sans serif"

(browser and server params work as expected)

Hello I have almost the same problem.
It is possible to set theme with st.set_option?

@Alea4jacta6est: I’d double-check that something weird isn’t happening with your installation / virtual env since unfortunately I can’t think of a reason why you’d get that error while on 0.79. Does running streamlit config show include a [theme] section in its output? It would also be worth checking that streamlit version verifies that the installation is version 0.79.

@LucianoSiqueira: it’s not possible to use st.set_option to set the theme. Please see the API docs for a list of options that are configurable using that API.

strange but streamlit version shows 0.79 however [theme] is absent. Just rebooting the system helped, may be cache problem…

Huh, that is quite strange. Hopefully this was indeed some sort of caching issue and the reboot ends up being a permanent fix.

In case this happens to reappear, please feel free to file an issue in GitHub and tag me in it as we’ll certainly want to investigate further.

I do have the same issue! I am using v0.79, I initialized the config.toml file streamlit config show > /.streamlit/config.toml, it works in the localhost. But same key-error in the share oven :frowning: