aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNerdyPepper <[email protected]>2018-07-05 14:55:03 +0100
committerNerdyPepper <[email protected]>2018-07-05 14:55:03 +0100
commitf60923353044467d654644018612836a06e4b4f0 (patch)
tree60b8efa14ac08dde202b616bae8ecff6fb9c24a0 /src
parenta1e4769c34219e28ec489159f01491dbffc929eb (diff)
Refactor
Diffstat (limited to 'src')
-rw-r--r--src/main.rs36
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;
6use cursive::traits::*; 6use cursive::traits::*;
7use cursive::views::{ TextView, Dialog, EditView, 7use cursive::views::{ TextView, Dialog, EditView,
8 SelectView, OnEventView }; 8 SelectView, OnEventView };
9use cursive::theme::PaletteColor::*;
10use cursive::theme::Color::*;
11use cursive::theme::BaseColor::*;
12use cursive::theme;
13use cursive::theme::BorderStyle;
14 9
15pub mod content; 10pub mod content;
16use content::*; 11use content::*;
17 12
13pub mod theme;
14use theme::*;
15
18fn main() { 16fn 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
88fn on_submit(s: &mut Cursive, name: &String) { 64fn on_submit(s: &mut Cursive, name: &String) {