impulse_ui_kit/
utils.rs

1//! Some utility for UI kit.
2
3/// Utility function to combine classes
4pub fn cn(base: &str, additional: Option<&str>) -> String {
5  match additional {
6    Some(class) => format!("{base} {class}"),
7    None => base.to_string(),
8  }
9}
10
11/// Dark theme colors provider.
12pub fn dark_theme() -> impulse_thaw::Theme {
13  let mut theme = impulse_thaw::Theme::dark();
14  theme.color.color_brand_background = "#fafafa".to_string();
15  theme.color.color_brand_background_hover = "#fafafae6".to_string();
16  theme.color.color_brand_background_pressed = "#fafafae6".to_string();
17  theme.color.color_neutral_background_1 = "#08080a".to_string();
18  theme.color.color_neutral_foreground_on_brand = "#18181b".to_string();
19  theme.color.color_neutral_foreground_2_brand_hover = "#fafafa".to_string();
20  theme.color.color_neutral_foreground_2_brand_pressed = "#fafafae6".to_string();
21  theme.color.color_neutral_foreground_2_brand_selected = "#fafafa".to_string();
22  theme
23}
24
25/// Light theme colors provider.
26pub fn light_theme() -> impulse_thaw::Theme {
27  let mut theme = impulse_thaw::Theme::light();
28  theme.color.color_brand_background = "#17171a".to_string();
29  theme.color.color_brand_background_hover = "#17171ae6".to_string();
30  theme.color.color_brand_background_pressed = "#17171ae6".to_string();
31  theme.color.color_neutral_foreground_on_brand = "#fafafa".to_string();
32  theme.color.color_neutral_foreground_2_brand_hover = "#18181b".to_string();
33  theme.color.color_neutral_foreground_2_brand_pressed = "#18181be6".to_string();
34  theme.color.color_neutral_foreground_2_brand_selected = "#18181b".to_string();
35  theme
36}