diff options
-rw-r--r-- | src/main.rs | 30 | ||||
-rw-r--r-- | src/theme.rs | 26 |
2 files changed, 29 insertions, 27 deletions
diff --git a/src/main.rs b/src/main.rs index 9b896a0..a3bbed6 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -2,9 +2,6 @@ | |||
2 | 2 | ||
3 | use chrono::NaiveDate; | 3 | use chrono::NaiveDate; |
4 | 4 | ||
5 | use cursive::theme::Color::*; | ||
6 | use cursive::theme::PaletteColor::*; | ||
7 | use cursive::theme::{BaseColor, BorderStyle, Palette, Theme}; | ||
8 | use cursive::views::{Dialog, LinearLayout}; | 5 | use cursive::views::{Dialog, LinearLayout}; |
9 | use cursive::Cursive; | 6 | use cursive::Cursive; |
10 | 7 | ||
@@ -14,34 +11,13 @@ use crate::habit::Habit; | |||
14 | mod views; | 11 | mod views; |
15 | use crate::views::BitView; | 12 | use crate::views::BitView; |
16 | 13 | ||
14 | mod theme; | ||
15 | |||
17 | enum ViewMode { | 16 | enum ViewMode { |
18 | Daily, | 17 | Daily, |
19 | Monthly, | 18 | Monthly, |
20 | } | 19 | } |
21 | 20 | ||
22 | fn pallete_gen() -> Palette { | ||
23 | let mut p = Palette::default(); | ||
24 | p[Background] = Dark(BaseColor::Black); | ||
25 | p[Shadow] = Light(BaseColor::Black); | ||
26 | p[View] = Dark(BaseColor::Black); | ||
27 | p[Primary] = Dark(BaseColor::White); | ||
28 | p[Secondary] = Light(BaseColor::Black); | ||
29 | p[Tertiary] = Dark(BaseColor::Green); | ||
30 | p[TitlePrimary] = Light(BaseColor::White); | ||
31 | p[Highlight] = Dark(BaseColor::Red); | ||
32 | p[HighlightInactive] = Dark(BaseColor::Black); | ||
33 | |||
34 | return p; | ||
35 | } | ||
36 | |||
37 | fn theme_gen() -> Theme { | ||
38 | let mut t = Theme::default(); | ||
39 | t.shadow = false; | ||
40 | t.borders = BorderStyle::Simple; | ||
41 | t.palette = pallete_gen(); | ||
42 | return t; | ||
43 | } | ||
44 | |||
45 | fn main() { | 21 | fn main() { |
46 | let mut work_out: Habit<bool> = Habit::new("gymming"); | 22 | let mut work_out: Habit<bool> = Habit::new("gymming"); |
47 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 4), true); | 23 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 4), true); |
@@ -71,6 +47,6 @@ fn main() { | |||
71 | .child(Dialog::around(reading_view).title(reading_title)), | 47 | .child(Dialog::around(reading_view).title(reading_title)), |
72 | ); | 48 | ); |
73 | 49 | ||
74 | s.set_theme(theme_gen()); | 50 | s.set_theme(theme::theme_gen()); |
75 | s.run(); | 51 | s.run(); |
76 | } | 52 | } |
diff --git a/src/theme.rs b/src/theme.rs new file mode 100644 index 0000000..5c4072b --- /dev/null +++ b/src/theme.rs | |||
@@ -0,0 +1,26 @@ | |||
1 | use cursive::theme::Color::*; | ||
2 | use cursive::theme::PaletteColor::*; | ||
3 | use cursive::theme::{BaseColor, BorderStyle, Palette, Theme}; | ||
4 | |||
5 | pub fn pallete_gen() -> Palette { | ||
6 | let mut p = Palette::default(); | ||
7 | p[Background] = Dark(BaseColor::Black); | ||
8 | p[Shadow] = Light(BaseColor::Black); | ||
9 | p[View] = Dark(BaseColor::Black); | ||
10 | p[Primary] = Dark(BaseColor::White); | ||
11 | p[Secondary] = Light(BaseColor::Black); | ||
12 | p[Tertiary] = Dark(BaseColor::Green); | ||
13 | p[TitlePrimary] = Light(BaseColor::White); | ||
14 | p[Highlight] = Dark(BaseColor::Red); | ||
15 | p[HighlightInactive] = Dark(BaseColor::Black); | ||
16 | |||
17 | return p; | ||
18 | } | ||
19 | |||
20 | pub fn theme_gen() -> Theme { | ||
21 | let mut t = Theme::default(); | ||
22 | t.shadow = false; | ||
23 | t.borders = BorderStyle::Simple; | ||
24 | t.palette = pallete_gen(); | ||
25 | return t; | ||
26 | } | ||