How to change the backgorund color of button widget

Hi @Jenny,

When you are trying to grab specific elements without something available on the front end to inherently distinguish them (like their label), you can use surrounding elements to pinpoint them. However, this becomes more tied to your specific script and arrangement to provide a clear answer. That’s why I suggested in the other thread to create a new topic with more specifics of your code/case. :slight_smile:

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

The best solution nowadays to make a button use the primary color of the app as its fill color is to set type="primary":

st.button("My button", type="primary")

If you need more button customizations beyond that, please see the CSS tricks below or let us know on this GitHub issue.

(I know this thread is quite old but since it’s still getting a lot of views + we have a non-hacky solution for the original problem, I thought it’s worth updating :wink:).

1 Like