I couldn’t use the div tags from your code to modify the color of the sidebar. However, this version worked for me
def add_custom_css() -> None:
st.markdown(
"""
<style>
div.st-emotion-cache-6qob1r.eczjsme3 {
color: white;
background-color: black;
}
</style>
""",
unsafe_allow_html=True
)
add_custom_css()
Your response seems similar to the one mentioned here, but it no longer works, unfortunately.
Additionally, the drawback of using my code is that if a new streamlit version is released in the future, the div tags could get renamed.