How to change font globally

How can I change font globally, for example to use Roboto everywhere?

Cheers

Hi @kannaiah -

font is one of the arguments as part of Themes:

https://docs.streamlit.io/library/advanced-features/theming

Best,
Randy

Thank you for the reply.
I have tried it but I see the following,

2022-04-04 00:43:10.766 “Roboto” is an invalid value for theme.font. Allowed values include [‘sans serif’, ‘serif’, ‘monospace’]. Setting theme.font to “sans serif”.

Used following code to get Roboto
Changing font in theme did not work for me

streamlit_style = """
			<style>
			@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap');

			html, body, [class*="css"]  {
			font-family: 'Roboto', sans-serif;
			}
			</style>
			"""
st.markdown(streamlit_style, unsafe_allow_html=True)
1 Like

My mistake, you are correct (as the code told you). The proper solution for arbitrary fonts right now is the code you demonstrate above :partying_face:

Best,
Randy