user14178341
user14178341

Reputation:

St.Success of Customization Problems (Streamlit)

Is there any way to change the font and background color, and opacity of st.success ? Because anything doesn’t seem with default colors. Here a visual for the problem: enter image description here

Upvotes: 1

Views: 1714

Answers (2)

user14178341
user14178341

Reputation:

 txt="text here"    
 htmlstr1=f"""<p style='background-color:green;
                                           color:white;
                                           font-size:18px;
                                           border-radius:3px;
                                           line-height:60px;
                                           padding-left:17px;
                                           opacity:0.6'>
                                           {txt}</style>
                                           <br></p>""" 
                    st.markdown(htmlstr1,unsafe_allow_html=True) 

This is an approach. It doesn't affect anywhere in my code.

Upvotes: 0

ferdy
ferdy

Reputation: 5034

import streamlit as st

st.markdown('''
<style>
.element-container {
    background-color: blue;
    opacity: 1;
}
.st-b7 {
    color: white;
}
.css-nlntq9 {
    font-family: Source Sans Pro;
}
</style>
''', unsafe_allow_html=True)

st.success('Whoever is happy will make others happy too. -Anne Frank')

enter image description here

Upvotes: 1

Related Questions