use revue::prelude::*;
pub fn theme_colors() -> (Color, Color, Color, Color, Color, Color, Color, Color) {
let t = use_theme().get();
(
t.palette.primary,
t.palette.success,
t.palette.warning,
t.palette.error,
t.palette.info,
t.colors.text_muted,
t.colors.text,
t.colors.surface,
)
}
pub fn themed_gauge(value: f64, label: &str, fill_color: Color, empty_bg: Color) -> Gauge {
Gauge::new()
.value(value)
.label(label)
.fill_color(fill_color)
.fill_background(fill_color.darken_pct(0.4))
.empty_background(empty_bg)
.width(20)
}
pub fn threshold_gauge(
value: f64,
label: &str,
normal_color: Color,
warning_color: Color,
empty_bg: Color,
threshold: f64,
) -> Gauge {
let fill_color = if value > threshold {
warning_color
} else {
normal_color
};
themed_gauge(value, label, fill_color, empty_bg)
}