How to change st.sidebar.slider default color?

Hi, I tried to change the st.sidebar.slider default pink color to others with the below codes but getting error. Can anyone help me out in this…

Code for default pink color:
st.sidebar.slider('ABC',0,20,10)

Tried with below code to change the color:
st.sidebar.slider.markdown(f'<div style="font-size: medium;text-align: left;color: Blue;">'ABC',0,20,10</div>',unsafe_allow_html=True)

OR

st.sidebar.slider.markdown("<h1 style='text-align: left; color: Blue;'>'ABC',0,20,10</h1>", unsafe_allow_html=True)

I’m not sure you’re able to change the color of that element at this type, as it appears that it is dynamically created:

.st-by {
    background: linear-gradient(to right, rgb(246, 51, 102) 0%, rgb(246, 51, 102) 75%, rgb(213, 218, 229) 75%, rgb(213, 218, 229) 100%);
}

If you open the developer panel of your browser and move the slider, you’ll notice that the percentage values change to indicate where on the slider you are. I’m not sure you can override that color scheme itself without changing the underlying slider code.

Thank you for your reply! But it won’t resolve.

Correct, as I mentioned I expect that this cannot work, because the CSS is being dynamically generated by the slider.

1 Like