ggplot_rs/theme/
elements.rs1#[derive(Clone, Debug)]
3pub struct ElementText {
4 pub family: String,
5 pub size: f64,
6 pub color: (u8, u8, u8),
7 pub angle: f64,
8 pub hjust: f64,
9 pub vjust: f64,
10 pub visible: bool,
11}
12
13impl ElementText {
14 pub fn blank() -> Self {
16 ElementText {
17 visible: false,
18 ..Default::default()
19 }
20 }
21}
22
23impl Default for ElementText {
24 fn default() -> Self {
25 ElementText {
26 family: "sans-serif".to_string(),
27 size: 12.0,
28 color: (0, 0, 0),
29 angle: 0.0,
30 hjust: 0.5,
31 vjust: 0.5,
32 visible: true,
33 }
34 }
35}
36
37#[derive(Clone, Debug)]
39pub struct ElementLine {
40 pub color: (u8, u8, u8),
41 pub width: f64,
42 pub visible: bool,
43}
44
45impl ElementLine {
46 pub fn blank() -> Self {
48 ElementLine {
49 visible: false,
50 ..Default::default()
51 }
52 }
53}
54
55impl Default for ElementLine {
56 fn default() -> Self {
57 ElementLine {
58 color: (0, 0, 0),
59 width: 1.0,
60 visible: true,
61 }
62 }
63}
64
65#[derive(Clone, Debug)]
67pub struct ElementRect {
68 pub fill: Option<(u8, u8, u8)>,
69 pub color: Option<(u8, u8, u8)>,
70 pub width: f64,
71 pub visible: bool,
72}
73
74impl ElementRect {
75 pub fn blank() -> Self {
77 ElementRect {
78 visible: false,
79 ..Default::default()
80 }
81 }
82}
83
84impl Default for ElementRect {
85 fn default() -> Self {
86 ElementRect {
87 fill: Some((255, 255, 255)),
88 color: None,
89 width: 0.0,
90 visible: true,
91 }
92 }
93}