Stremlit's dynamically named css classes

I’m trying to restyle a Streamlit app to use a different color palette with a dark background. Using unsafe_allow_html to update CSS properties was easy in many cases, but many widgets are styled by these classes with names like .c5 .c6 .c7 .d5 .d6 etc.

The issue I’m trying to work around now is that these class names aren’t consistent from one pageload to the next. I briefly looked at the Streamlit code to see where this was generated and think about a workaround, but I didn’t find it.

Any advice about how I can control CSS styles for widgets styled with these css classes, or advice on where to look to understand what’s happening better?

Apologies if this is asking for help on something that isn’t meant to be supported,


Hi @Dan_Becker ,

This is not supported right now, you can try to hack it with unsafe HTML but yes, the BaseWeb library uses Stylatron which makes this hard. We are looking at official support for styling, but it won’t land for a few months.