How to change font / .streamlit config / Themes

Dear all,
I am developing streamlit application in corporate.
I have my interpreter saved on shared drive, together with

How to best change the font to Calibri in whole application?

  1. ChatGPT suggested include CSS code in application, but this doesn’t work:
custom_css = """
    /* Replace 'Agency FB' with the desired font family */
    body {
        font-family: 'Calibri', sans-serif;

st.markdown(custom_css, unsafe_allow_html=True)

That would be the easiest way, do you have any tips how to fix it?

  1. I saw in the formuls old post that you can somehow add your custom Theme in .streamlit config.toml , but I cannot find it anywhere on my computer… (it’s not in Interpreter folder, it’s not in my application folder). I suspect it might be somewhere in my local files (user), but given this application is started from shared drive by multiple people, how I can create one config.toml and point application to use always saved one i.e. on shared drive, instead of having multiple files for multiple people saved locally?

Any other ideas?

Apologies for possibly stupid questions, begginier in coding here and complete noob with CSS.

Thank you

Your config.toml file needs to go in a .streamlit folder in the root of your project directory. You just manually create it if you don’t already have one. For example:

├── .streamlit/
│   └── config.toml
└── requirements.txt

However, the current support for font in config.toml is:

# Font family for all text in the app, except code blocks. One of "sans serif",
# "serif", or "monospace".
# font =

If you are looking to use a different font than the three available, you have to override it with CSS.

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