Changing text colors in radio inputs

hello,
for this code snippet

st.radio("Choose the order type", ["A", "B"] )

how can i change the text color of “Choose the order type”. I want the color specifically to be white
Please help.
Thanks

Hi @Jino_R,

Thanks for posting!

Are you going to use a dark background? If yes, then you won’t need to specify the color since white will be the default. The following are the supported colors using the syntax :color[text to be colored]: blue, green, orange, red, violet, gray/grey, and rainbow.

Here’s a shot at a workaround if using white is a must. However we introduce markdown for the text;

import streamlit as st

st.markdown("""
<style>
label[for*="streamlit"] {
    color: white;
}
</style>
""", unsafe_allow_html=True)

st.markdown('<p style="color:white;">Choose the order type</p>', unsafe_allow_html=True)
choice = st.radio("", ["A", "B"])
1 Like

thanks , but using markdown, theres a huge space that appears betwwen the choices A and B and the markdown text, how to fix that

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.