Deploying to Heroku with custom theme

Hi! I managed to change the theme of my app while building it in my local host. When I deploy this on Heroku, should I include the config.toml I used locally so that the deployed app will have the theme settings I want?

Yes put it in .streamlit/config.toml and make sure it is deployed.

Thank you for answering, but I’m not sure I get what you mean.

I got it, thank you. I put this in my setup.sh:

mkdir -p ~/.streamlit/

echo "[theme]
primaryColor = ‘#84a3a7
backgroundColor = ‘#EFEDE8
secondaryBackgroundColor = ‘#fafafa
textColor= ‘#424242
font = ‘sans serif’
[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml

I haven’t used Heroku, but this seems to be the right way to go, according to this article:

https://towardsdatascience.com/quickly-build-and-deploy-an-application-with-streamlit-988ca08c7e83

Hi @Phoemela_Ballaran -

Here is an example of having a file in your repo, so that you don’t have to dynamically create anything:

Create a folder labelled .streamlit in your code repo, then place the config.toml file in it. Commit it to GitHub and it will exist in your repo when you deploy it.

Best,
Randy

That’s so cool! Thanks @randyzwitch !

1 Like

I am doing as said in this post but after deployment the theme is set to default and not the custom selected one ,what should I do ?

hello , after 12hours of trying on my confg.toml i fined that there’s a difference between " and ’ :
so try :
mkdir -p ~/.streamlit/
echo "[theme]
primaryColor=’#020202
backgroundColor=’#c4c3c3
secondaryBackgroundColor=’#ebd316
font = ‘sans serif’
[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml

i hope that this will help you .

2 Likes

It actually worked :+1::pray:

Thanks a bunch, it really helped!