-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Problem
When creating metrics, the inability to change the color of the value inside the metric means that if a user wants to display if a metric has reached a certain threshold, they are unable to. For my use case, I would like to change the value inside the metric or at least change the color of the outline of the metric to determine whether the value has reached a certain threshold. For example, if I have a metric displaying the average gas price and I want to make the value red when the average gas price rises above $4.00 and green for when it's lower than $4.00, there is no current way to change the color besides delving into the internal CSS.
Solution
MVP: Support colored text for the value argument (like being able to pass in :green[value] for the value argument)
Possible additions: Add a background_color argument that lets the user change the background color of the metric and add a font_size argument that lets the user change the font size of the value in the metric.
Additional context
The proposal for this came from sifting through multiple posts on the Streamlit forum where multiple users were looking for more customization with st.metric, namely changing the color and font size of the value inside the metric as seen below:
Many other users of Streamlit have also expressed a want for more customization with metrics: