use gpui::{Hsla, hsla};
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) struct FpsStyle {
pub background: Hsla,
pub foreground: Hsla,
pub muted: Hsla,
pub good: Hsla,
pub warn: Hsla,
pub bad: Hsla,
}
impl Default for FpsStyle {
fn default() -> Self {
Self::dark()
}
}
impl FpsStyle {
pub(crate) fn dark() -> Self {
Self {
background: hsla(0., 0., 0.04, 0.92),
foreground: hsla(0., 0., 0.98, 1.),
muted: hsla(0., 0., 0.62, 1.),
good: hsla(0.41, 0.95, 0.56, 1.),
warn: hsla(0.11, 0.95, 0.6, 1.),
bad: hsla(0.99, 0.9, 0.62, 1.),
}
}
pub(crate) fn level_color(&self, frame_secs: f32, budget_secs: f32) -> Hsla {
if frame_secs <= budget_secs {
self.good
} else if frame_secs <= budget_secs * 2. {
self.warn
} else {
self.bad
}
}
}