How to set the background color and text color of "st.header","st.write" etc. and let the text be showed at the left side of input and select box?

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.

3 Likes

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.

10 Likes

How do I change the text color for st.write (“ColorMeBlue text”)

How can I change the ColorMeBlue to blue color?

Thanks

3 Likes

please refer to my this example

you can use it to replace st.write, st.warning, st.info, st.success

1 Like

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)

1 Like

How to change text colour inside selectboxes and file uploaders individually?