Know the theme in code

I am using st.theme() and when running the code i did got

AttributeError: module ‘streamlit’ has no attribute ‘theme’.

Is there anyway to know the theme within code?

Thank you

You got this error because there are no attribute named st.theme(). Could you please share the link where people are referencing such a module? I wonder if it was a discussion about features that could be helpful. Such as this Check if the app is in dark mode or light mode at runtime

Anyway, you can take a look at Creating Custom Themes for Streamlit Apps and that would help you with your theme. Basically, you create a .streamlit folder and insert your config.toml file with the theme information.

I am using light theme for development and when dark theme is selected headers are still having light theme color. Is there anyway that i can fix it. For header am using st.title(“Title”) and in Dark theme it is gray as in light theme. Please suggest

Go to the config.toml file and create something like the solarized theme as shown in Creating Custom Themes for Streamlit Apps this will become your customized theme.

[theme]

primaryColor="#d33682"
backgroundColor="#002b36"
secondaryBackgroundColor="#586e75"
textColor="#fafafa"
font="sans serif"

At the development stage you can go back to the standard light theme, and then toggle back to your customized theme.

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