Background and text colors

I bow to your awesomness creating this tool. Presentation to my team later this week. QQ: is it possible to set the page background color (to black) and the text color (to white). Out team logo is on a black backgpound.

Thanks!

Welcome to the Streamlit community and thank you for the kind words :smiley:

We’ve had that come up a few times recently, and we’re considering different ways to support it. We want to make theming super easy, so the exact API may take a little time to land. Here’s a feature request you can follow/upvote/comment on!

In the meantime, some users have been hacking this together by passing a <style> block into st.markdown with unsafe_allow_html=True. The problem with this is you’ll have to update a lot of styles to get things to look the way you want it :cry: .

Hope this helps and good luck on the presentation, we’d love to hear how it goes!

Give us the whole code

Hi @Tshokelo_Mokubi,

You’ll find an example of background color here and text color formatting here.

Best
Fanilo

Text color formatting is as simple as the following (using ‘red’ as an example):

<*font color=‘red’>THIS TEXT WILL BE RED</*font>, unsafe_allow_html=True)

Just delete both *'s inside the font blocks.

This code isn’t working can you please help

It really works!!! THANK YOU

You can easily do this via theming nowadays. Just add the following text to your config file (in .streamlit/config.toml) to get black background and white text color:

[theme]
backgroundColor="#000000"
textColor="#ffffff"

There are also more options, see our theming docs. Btw, if you want to change the color of a small piece of text, you can use colored text in st.markdown, see the docstring for body.