layout/core/
style.rs

1//! This module represents general shape style information.
2
3use crate::core::color::Color;
4
5#[derive(Debug, Copy, Clone)]
6pub enum LineStyleKind {
7    Normal,
8    Dashed,
9    Dotted,
10    None,
11}
12
13#[derive(Clone, Debug)]
14pub struct StyleAttr {
15    pub line_color: Color,
16    pub line_width: usize,
17    pub fill_color: Option<Color>,
18    pub rounded: usize,
19    pub font_size: usize,
20}
21
22impl StyleAttr {
23    pub fn new(
24        line_color: Color,
25        line_width: usize,
26        fill_color: Option<Color>,
27        rounded: usize,
28        font_size: usize,
29    ) -> Self {
30        Self {
31            line_color,
32            line_width,
33            fill_color,
34            rounded,
35            font_size,
36        }
37    }
38
39    pub fn simple() -> Self {
40        StyleAttr::new(
41            Color::fast("black"),
42            2,
43            Option::Some(Color::fast("white")),
44            0,
45            15,
46        )
47    }
48
49    pub fn debug0() -> Self {
50        StyleAttr::new(
51            Color::fast("black"),
52            1,
53            Option::Some(Color::fast("pink")),
54            0,
55            15,
56        )
57    }
58    pub fn debug1() -> Self {
59        StyleAttr::new(
60            Color::fast("black"),
61            1,
62            Option::Some(Color::fast("aliceblue")),
63            0,
64            15,
65        )
66    }
67    pub fn debug2() -> Self {
68        StyleAttr::new(
69            Color::fast("black"),
70            1,
71            Option::Some(Color::fast("white")),
72            0,
73            15,
74        )
75    }
76}