From 31080303feefd09d9d5ce1844b90bc6bf58a245a Mon Sep 17 00:00:00 2001 From: Arnaud Date: Thu, 31 Oct 2024 09:56:39 +0000 Subject: [PATCH] Dark colors --- src/streamlit_extras/metric_cards/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/streamlit_extras/metric_cards/__init__.py b/src/streamlit_extras/metric_cards/__init__.py index fcc580a6..520d0c60 100644 --- a/src/streamlit_extras/metric_cards/__init__.py +++ b/src/streamlit_extras/metric_cards/__init__.py @@ -1,7 +1,7 @@ import streamlit as st from streamlit_extras import extra - +from streamlit_extras.theme import st_theme @extra def style_metric_cards( @@ -24,6 +24,13 @@ def style_metric_cards( box_shadow (bool, optional): Whether a box shadow is applied. Defaults to True. """ + theme = st_theme() + + # When dark mode, convert background and border to be dark + if theme.get("base") == "dark": + background_color = "#1B1C24" + border_color = "#292D34" + box_shadow_str = ( "box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;" if box_shadow