Thèmes personnalisés

Streamlit 1.0, publié en octobre 2021, stabilise le système de thèmes. Les couleurs, polices et styles peuvent être personnalisés via .streamlit/config.toml. Le thème s'applique à tous les composants natifs et widgets.

Configuration du thème

toml
# .streamlit/config.toml
[theme]
primaryColor = "#FF4B4B"
backgroundColor = "#0E1117"
secondaryBackgroundColor = "#262730"
textColor = "#FAFAFA"
font = "sans serif"
python
import streamlit as st

st.set_page_config(
    page_title='Mon App',
    layout='wide',
)

st.title('Application avec thème personnalisé')
st.slider('Valeur', 0, 100, 50)
st.button('Valider')

# Le thème défini dans config.toml s'applique
# automatiquement à tous les composants

Sources