conrod_core/
border.rs

1use color::{hsl, hsla, rgb, rgba, Color};
2
3/// To be used as a parameter for defining the aesthetic
4/// of the widget border.
5#[derive(Copy, Clone)]
6pub enum Bordering {
7    /// Border width and color.
8    Border(f64, Color),
9    /// No border.
10    NoBorder,
11}
12
13/// Widgets that may display a border.
14pub trait Borderable: Sized {
15    /// Set the width of the widget's border.
16    fn border(self, width: f64) -> Self;
17
18    /// Set the color of the widget's border.
19    fn border_color(self, color: Color) -> Self;
20
21    /// Set the color of the widget's border with rgba values.
22    fn border_rgba(self, r: f32, g: f32, b: f32, a: f32) -> Self {
23        self.border_color(rgba(r, g, b, a))
24    }
25
26    /// Set the color of the widget's border with rgb values.
27    fn border_rgb(self, r: f32, g: f32, b: f32) -> Self {
28        self.border_color(rgb(r, g, b))
29    }
30
31    /// Set the color of the widget's border with hsla values.
32    fn border_hsla(self, h: f32, s: f32, l: f32, a: f32) -> Self {
33        self.border_color(hsla(h, s, l, a))
34    }
35
36    /// Set the color of the widget's border with hsl values.
37    fn border_hsl(self, h: f32, s: f32, l: f32) -> Self {
38        self.border_color(hsl(h, s, l))
39    }
40}