diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/main.rs b/src/main.rs index af06dd5..d41e6b2 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -6,44 +6,19 @@ use cursive::Cursive; | |||
6 | use cursive::traits::*; | 6 | use cursive::traits::*; |
7 | use cursive::views::{ TextView, Dialog, EditView, | 7 | use cursive::views::{ TextView, Dialog, EditView, |
8 | SelectView, OnEventView }; | 8 | SelectView, OnEventView }; |
9 | use cursive::theme::PaletteColor::*; | ||
10 | use cursive::theme::Color::*; | ||
11 | use cursive::theme::BaseColor::*; | ||
12 | use cursive::theme; | ||
13 | use cursive::theme::BorderStyle; | ||
14 | 9 | ||
15 | pub mod content; | 10 | pub mod content; |
16 | use content::*; | 11 | use content::*; |
17 | 12 | ||
13 | pub mod theme; | ||
14 | use theme::*; | ||
15 | |||
18 | fn main() { | 16 | fn main() { |
19 | // Initial setup | 17 | // Initial setup |
20 | let mut main = Cursive::default(); | 18 | let mut main = Cursive::default(); |
21 | 19 | ||
22 | // basic theme | ||
23 | let mut wikitheme = main.current_theme().clone(); | ||
24 | |||
25 | // set the theme's | ||
26 | // shadow | ||
27 | wikitheme.shadow = false; | ||
28 | // border | ||
29 | wikitheme.borders = BorderStyle::Simple; | ||
30 | // and palette | ||
31 | let mut palette: theme::Palette = theme::Palette::default(); | ||
32 | palette.set_color("background" , Dark(Black)); | ||
33 | palette.set_color("shadow" , Dark(White)); | ||
34 | palette.set_color("view" , Dark(Black)); | ||
35 | palette.set_color("primary" , Dark(White)); | ||
36 | palette.set_color("secondary" , Dark(Blue)); | ||
37 | palette.set_color("teritary" , Dark(Green)); | ||
38 | palette.set_color("title_primary" , Dark(Blue)); | ||
39 | palette.set_color("title_secondary" , Dark(Green)); | ||
40 | palette.set_color("highlight" , Dark(Blue)); | ||
41 | palette.set_color("highlight_inactive" , Dark(Red)); | ||
42 | |||
43 | wikitheme.palette = palette; | ||
44 | |||
45 | // set theme | 20 | // set theme |
46 | main.set_theme(wikitheme); | 21 | main.set_theme(theme_gen()); |
47 | 22 | ||
48 | main.add_global_callback('q', |s| s.quit()); | 23 | main.add_global_callback('q', |s| s.quit()); |
49 | main.add_global_callback('s', |s| search(s)); | 24 | main.add_global_callback('s', |s| search(s)); |
@@ -82,7 +57,8 @@ fn search(s: &mut Cursive){ | |||
82 | }) | 57 | }) |
83 | .button("Cancel", |s| match s.pop_layer(){ | 58 | .button("Cancel", |s| match s.pop_layer(){ |
84 | _ => () | 59 | _ => () |
85 | })); | 60 | }) |
61 | .fixed_size(( 35, 5 ))); | ||
86 | } | 62 | } |
87 | 63 | ||
88 | fn on_submit(s: &mut Cursive, name: &String) { | 64 | fn on_submit(s: &mut Cursive, name: &String) { |