How can I call the default theme colours if i haven’t set an alternative in my config.toml - I feel like st.get_option(“theme.redColor”) should work, but it returns NULL.
Hey there, thanks for your question!
You’re right—using st.get_option("theme.redColor") will only return a value if you’ve explicitly set that color in your config.toml. If you haven’t set a custom theme, Streamlit uses its built-in default theme colors, but these defaults aren’t exposed to Python via st.get_option unless overridden in your config file. So, st.get_option("theme.redColor") returns None (not the default) when not set by you. This is a known limitation and has been discussed in the community and on GitHub—there’s currently no built-in way to programmatically access the default theme colors from Python if they’re not set in config.toml or via command-line options. See the discussion here and here.
If you need the actual default values, you’ll have to hardcode them in your app (e.g., #ff4b4b for red in the light theme, #ff2b2b for dark), or use a custom component like st-theme to fetch the active theme from the frontend. For reference, the default palette is documented here.
Sources:
Thanks. I will hard code for now - I was reluctant to do this because of the planned format change here (Modernize Streamlit's default light and dark themes · Issue #16657 · streamlit/streamlit · GitHub) so wanted it dynamic.