Skip to main content

material_ui_rs/design/style/
progress_bar.rs

1use iced_widget::core::{Background, border};
2use iced_widget::progress_bar::{Catalog, Style, StyleFn};
3
4use crate::Theme;
5use crate::tokens;
6
7impl Catalog for Theme {
8    type Class<'a> = StyleFn<'a, Self>;
9
10    fn default<'a>() -> Self::Class<'a> {
11        Box::new(default)
12    }
13
14    fn style(&self, class: &Self::Class<'_>) -> Style {
15        class(self)
16    }
17}
18
19pub fn default(theme: &Theme) -> Style {
20    Style {
21        background: Background::Color(theme.colors().surface.container.highest),
22        bar: Background::Color(theme.colors().primary.color),
23        border: border::rounded(tokens::component::linear_progress::TRACK_SHAPE),
24    }
25}
26
27#[cfg(test)]
28#[path = "../../../tests/design/style/progress_bar.rs"]
29mod tests;