import streamlit as st def custom_metric_box(label: str, value: str) -> None: """ Create a styled metric box with a compact layout. This function generates a styled markdown box displaying a label and its corresponding value. Parameters: ---------- label : str The text label to display in the metric box. value : str The value to be displayed in the metric box, typically representing a metric. Returns: ------- None """ st.markdown( f"""

{label}

{value}

""", unsafe_allow_html=True, ) def pollution_box(label: str, value: str, delta: str, threshold: float) -> None: """ Create a pollution metric box with a side-by-side layout and fixed width. Parameters: ---------- label : str The text label representing the type of pollution or metric. value : str The value of the pollution metric. delta : str The change in pollution level. threshold : float The threshold value to determine pollution level status. """ current_value = float(value.split()[0]) # Determine status and color based on the same logic as get_simple_color_scale if current_value < threshold: status = "Good" status_color = "#77C124" elif current_value < 2 * threshold: status = "Medium" status_color = "#E68B0A" else: status = "Bad" status_color = "#E63946" # Render the pollution box st.markdown( f"""

{label}

{status}

{value}

""", unsafe_allow_html=True, )