vor 0.2.1

Cross-platform performance instrumentation with an in-app egui panel and live system and GPU metrics.
Documentation
use egui::Color32;

pub(super) const fn health_color(value: f64, good: f64, warn: f64) -> Color32 {
    if value > warn {
        Color32::from_rgb(231, 76, 60)
    } else if value > good {
        Color32::from_rgb(241, 196, 15)
    } else {
        Color32::from_rgb(46, 204, 113)
    }
}

/// Stable per-name color from an 8-hue palette, picked by FNV hash.
pub(super) fn hash_color(name: &str) -> Color32 {
    const PALETTE: [Color32; 8] = [
        Color32::from_rgb(80, 160, 240),
        Color32::from_rgb(160, 240, 120),
        Color32::from_rgb(240, 160, 80),
        Color32::from_rgb(200, 130, 220),
        Color32::from_rgb(120, 220, 200),
        Color32::from_rgb(240, 200, 80),
        Color32::from_rgb(220, 100, 140),
        Color32::from_rgb(140, 180, 240),
    ];
    let mut h: u32 = 2_166_136_261;
    for b in name.bytes() {
        h ^= b as u32;
        h = h.wrapping_mul(16_777_619);
    }
    PALETTE[(h as usize) % PALETTE.len()]
}