You can use the colors by using this:
pc = st.get_option('theme.primaryColor')
bc = st.get_option('theme.backgroundColor')
sbc = st.get_option('theme.secondaryBackgroundColor')
tc = st.get_option('theme.textColor')
If i understand right, this takes the colors ONLY if you use the external settings.
by external settings i mean creating a file names .streamlit near the app script, and input something like:
config.toml (The name of the file yo should create)
[theme]
primaryColor = "#8270b3"
backgroundColor = "#0E1117"
secondaryBackgroundColor = "#2c2c2c"
textColor = "#FAFAFA"
font = "monospace"
Also you are free to edit my custom theme, it has some cool options IMHO.