Check if the app is in dark mode or light mode at runtime

This is useful. For instance, I want to place a logo on my Streamlit app. If I could check the theme at runtime, I would use specific image files for light and dark modes.

E.g.:

if st.theme() == 'Dark':
    st.image('dark_logo.png')
else:
    st.image('light_logo.png')

Thanks!

5 Likes