diff options
author | Canop <cano.petrole@gmail.com> | 2019-11-13 16:21:46 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2019-11-13 16:21:46 +0100 |
commit | 8a45af31a58fe577ff9361850775137d31f0a9de (patch) | |
tree | 1d845aadba394a624172dbfdfec473baa2f889d6 | |
parent | 7461f473cc28c17dc035c3b75c793f813c86fd0a (diff) |
add a white background skin in web site, and refers to it in conf
Fix #74
-rw-r--r-- | src/browser_states.rs | 4 | ||||
-rw-r--r-- | src/cli.rs | 18 | ||||
-rw-r--r-- | src/conf.rs | 7 | ||||
-rw-r--r-- | src/screens.rs | 4 | ||||
-rw-r--r-- | src/skin.rs | 3 | ||||
-rw-r--r-- | website/docs/documentation/configuration.md | 45 | ||||
-rw-r--r-- | website/docs/img/20191112-overview.png | bin | 32935 -> 30791 bytes | |||
-rw-r--r-- | website/docs/img/20191114-light-skin.png | bin | 0 -> 44910 bytes |
8 files changed, 71 insertions, 10 deletions
diff --git a/src/browser_states.rs b/src/browser_states.rs index 9b7833a..79ecfe1 100644 --- a/src/browser_states.rs +++ b/src/browser_states.rs @@ -19,7 +19,7 @@ use crate::{ help_states::HelpState, io::W, patterns::Pattern, - screens::Screen, + screens::{self, Screen}, status::Status, task_sync::TaskLifetime, tree_build::TreeBuilder, @@ -439,7 +439,7 @@ impl AppState for BrowserState { ) -> Result<(), ProgramError> { let tree = self.displayed_tree(); - let total_char_size = 10; + let total_char_size = screens::FLAGS_AREA_WIDTH; screen.goto_clear(w, screen.width - total_char_size - 1, screen.height - 1)?; let h_value = if tree.options.show_hidden { 'y' } else { 'n' }; let gi_value = match tree.options.respect_git_ignore { @@ -112,7 +112,23 @@ fn get_cli_args<'a>() -> clap::ArgMatches<'a> { pub fn read_launch_args() -> Result<AppLaunchArgs, ProgramError> { let cli_args = get_cli_args(); let mut root = match cli_args.value_of("root") { - Some(path) => PathBuf::from(path), + Some(path) => { + + /* + // On windows we unwrap the argument if it's given between + // double quotes, which notably happens when broot is called + // because mapped to a right click action in Explorer. + // Related issue: #72 + // I'm not sure it's the best way. Inputs welcome. + #[cfg(windows)] { + if path.starts_with('"') && path.ends_with('"') { + path = &path[1..path.len()-1]; + } + } + */ + + PathBuf::from(path) + } None => env::current_dir()?, }; if !root.exists() { diff --git a/src/conf.rs b/src/conf.rs index fc43cb3..5ae0655 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -213,8 +213,6 @@ execution = "$PAGER {file}" # pruning = "rgb(89, 73, 101) none Italic" # permissions = "gray(12) none " # selected_line = "none gray(3)" -# size_bar = "black rgb(255, 152, 0)" -# size_no_bar = "gray(15) gray(2)" # char_match = "yellow none" # file_error = "Red none" # flag_label = "gray(16) none" @@ -234,4 +232,9 @@ execution = "$PAGER {file}" # help_italic = "Magenta rgb(30, 30, 40) italic" # help_code = "gray(21) gray(3)" # help_headers = "rgb(255, 187, 0) none" + +# You may find other skins on +# https://dystroy.org/broot/documentation/configuration/#colors +# for example a skin suitable for white backgrounds + "#; diff --git a/src/screens.rs b/src/screens.rs index 546bfbd..2fce589 100644 --- a/src/screens.rs +++ b/src/screens.rs @@ -15,6 +15,8 @@ use crate::{ skin::Skin, }; +pub static FLAGS_AREA_WIDTH: u16 = 10; + pub struct Screen { pub width: u16, pub height: u16, @@ -46,7 +48,7 @@ impl Screen { self.height = h; } debug!("screen size: {} x {}", self.width, self.height); - self.input_field.change_area(0, h-1, w - 15); + self.input_field.change_area(0, h-1, w - FLAGS_AREA_WIDTH); debug!("input_field area: {:?}", self.input_field.area); Ok(()) } diff --git a/src/skin.rs b/src/skin.rs index f76b2c1..5b58a11 100644 --- a/src/skin.rs +++ b/src/skin.rs @@ -70,11 +70,10 @@ Skin! { directory: Some(Blue), None; {Bold} exe: Some(Cyan), None; link: Some(Magenta), None; - pruning: gray(17), None; {Italic} + pruning: gray(12), None; {Italic} permissions: gray(15), None; dates: ansi(109), None; selected_line: None, gray(4); - size_bar: Some(White), gray(2); char_match: Some(Green), None; file_error: Some(Red), None; flag_label: gray(15), gray(1); diff --git a/website/docs/documentation/configuration.md b/website/docs/documentation/configuration.md index 1991480..de7d23f 100644 --- a/website/docs/documentation/configuration.md +++ b/website/docs/documentation/configuration.md @@ -219,6 +219,8 @@ Note that # Colors +## Skin configuration + You can change all colors by adding a `[skin]` section in your `conf.toml` file. For example: @@ -232,8 +234,6 @@ For example: pruning = "rgb(89, 73, 101) none Italic" permissions = "gray(12) none " selected_line = "none gray(3)" - size_bar = "black rgb(255, 152, 0)" - size_no_bar = "gray(15) gray(2)" char_match = "yellow none" file_error = "Red none" flag_label = "gray(16) none" @@ -281,3 +281,44 @@ Currently supported attributes are: * underlined * overlined +Note that some of them may be ignored by your terminal. Windows supports about none of them, for example. + +## White background skin + +If your console has a white background, the default skin is probably not convenient. + +Here's a skin specifically designed for this case: + +![light skin](../img/20191114-light-skin.png) + + [skin] + tree = "gray(17) none" + file = "gray(1) none" + directory = "ansi(20) none bold" + exe = "ansi(178) none" + link = "Magenta none" + pruning = "gray(5) none Italic" + permissions = "gray(4) none " + selected_line = "none gray(21)" + char_match = "ansi(28) none" + file_error = "Red none" + flag_label = "gray(16) none" + flag_value = "ansi(202) none bold" + input = "ansi(0) none" + status_error = "ansi(196) gray(22)" + status_job = "ansi(220) gray(5)" + status_normal = "gray(2) gray(22)" + status_italic = "ansi(202) None" + status_bold = "ansi(202) None bold" + status_code = "ansi(17) gray(22)" + status_ellipsis = "gray(1) gray(23)" + scrollbar_track = "gray(20) none" + scrollbar_thumb = "ansi(238) none" + help_paragraph = "gray(2) none" + help_bold = "ansi(202) none bold" + help_italic = "ansi(202) none italic" + help_code = "gray(5) gray(22)" + help_headers = "ansi(202) none" + +(don't hesitate to contact me or to do a PR if you have a better skin to propose) + diff --git a/website/docs/img/20191112-overview.png b/website/docs/img/20191112-overview.png Binary files differindex c3de2b0..b02017b 100644 --- a/website/docs/img/20191112-overview.png +++ b/website/docs/img/20191112-overview.png diff --git a/website/docs/img/20191114-light-skin.png b/website/docs/img/20191114-light-skin.png Binary files differnew file mode 100644 index 0000000..9e106ea --- /dev/null +++ b/website/docs/img/20191114-light-skin.png |