use std::any::TypeId;
use crate::core::{Property, UpdateCtx};
use crate::peniko::color::{AlphaColor, Srgb};
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct BarColor(pub AlphaColor<Srgb>);
impl Property for BarColor {
fn static_default() -> &'static Self {
static DEFAULT: BarColor = BarColor(AlphaColor::BLACK);
&DEFAULT
}
}
impl Default for BarColor {
fn default() -> Self {
*Self::static_default()
}
}
impl BarColor {
pub fn prop_changed(ctx: &mut UpdateCtx<'_>, property_type: TypeId) {
if property_type != TypeId::of::<Self>() {
return;
}
ctx.request_paint_only();
}
}