1use color::{hsl, hsla, rgb, rgba, Color};
2use ui::Ui;
3
4pub type FontSize = u32;
6
7pub trait Labelable<'a>: Sized {
9 fn label(self, text: &'a str) -> Self;
11
12 fn label_color(self, color: Color) -> Self;
14
15 fn label_rgba(self, r: f32, g: f32, b: f32, a: f32) -> Self {
17 self.label_color(rgba(r, g, b, a))
18 }
19
20 fn label_rgb(self, r: f32, g: f32, b: f32) -> Self {
22 self.label_color(rgb(r, g, b))
23 }
24
25 fn label_hsla(self, h: f32, s: f32, l: f32, a: f32) -> Self {
27 self.label_color(hsla(h, s, l, a))
28 }
29
30 fn label_hsl(self, h: f32, s: f32, l: f32) -> Self {
32 self.label_color(hsl(h, s, l))
33 }
34
35 fn label_font_size(self, size: FontSize) -> Self;
37
38 fn small_font(self, ui: &Ui) -> Self {
40 self.label_font_size(ui.theme.font_size_small)
41 }
42
43 fn medium_font(self, ui: &Ui) -> Self {
45 self.label_font_size(ui.theme.font_size_medium)
46 }
47
48 fn large_font(self, ui: &Ui) -> Self {
50 self.label_font_size(ui.theme.font_size_large)
51 }
52}