forked from reya/gpui-native-kit
@@ -41,6 +41,7 @@ pub struct Spinner {
|
||||
value: Option<f32>,
|
||||
variant: SpinnerVariant,
|
||||
size: Size,
|
||||
color: Option<Hsla>,
|
||||
a11y_label: Option<SharedString>,
|
||||
}
|
||||
|
||||
@@ -55,10 +56,17 @@ impl Spinner {
|
||||
value: None,
|
||||
variant: SpinnerVariant::default(),
|
||||
size: Size::default(),
|
||||
color: None,
|
||||
a11y_label: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Overrides the arc color, for accent-filled surfaces.
|
||||
pub fn color(mut self, color: Hsla) -> Self {
|
||||
self.color = Some(color);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the spinner's visual language.
|
||||
pub fn variant(mut self, variant: SpinnerVariant) -> Self {
|
||||
self.variant = variant;
|
||||
@@ -93,7 +101,7 @@ impl RenderOnce for Spinner {
|
||||
let side = theme.sizes.resolve(self.size).icon_size;
|
||||
let stroke = side * RING_STROKE;
|
||||
let track = theme.colors.border;
|
||||
let accent = theme.ramps.primary.base;
|
||||
let accent = self.color.unwrap_or(theme.ramps.primary.base);
|
||||
let value = self.value.map(|value| value.clamp(0.0, 1.0));
|
||||
|
||||
div()
|
||||
|
||||
Reference in New Issue
Block a user