1.if we want the change the backgroud color or text color of st.header, st.write, st.info, st.success, st.warning and etc.
how should we set in python program?
2.if we want to let the text be showed with the st.input and st.selectbox within same row(left side of input or select box), how should we set in python program?
thank you.
I found a way to change the text background color, use different colors to replace st.header, st.write, st.success, st.warning
code is like this:
def header(url):
st.markdown(f'<p style="background-color:#0066cc;color:#33ff33;font-size:24px;border-radius:2%;">{url}</p>', unsafe_allow_html=True)
header(“notice”)
and where you put ‘header(“notice”)’, the background color of text “notice” will change into “#0066cc” text color will be #33ff33 and font size will be 24px.
How do I change the text color for st.write (“ColorMeBlue text”)
How can I change the ColorMeBlue to blue color?
Thanks
please refer to my this example
you can use it to replace st.write, st.warning, st.info, st.success
this may help you get what you want :
st.markdown(f'<h1 style="color:#33ff33;font-size:24px;">{"ColorMeBlue text”"}</h1>', unsafe_allow_html=True)
How to change text colour inside selectboxes and file uploaders individually?
We now have a built-in feature to use colored text in st.write
, st.markdown
, st.header
, etc:
st.markdown("This is black and :red[this is red!]")
You can use the colors blue, green, orange, red, violet, gray/grey, rainbow in the same way. See also the docstring of the body
parameter.