mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-09 16:00:35 +00:00
add select-bg-color
This commit is contained in:
parent
4643c4ca0f
commit
a1792ea196
11
src/main.rs
11
src/main.rs
@ -54,10 +54,16 @@ fn app_args<'a>() -> clap::ArgMatches<'a> {
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("select_foreground_color")
|
||||
.help("Sets the foregroud color for selection")
|
||||
.help("Sets the foreground color for selection")
|
||||
.long("select-fg-color")
|
||||
.default_value("blue"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("select_background_color")
|
||||
.help("Sets the background color for selection")
|
||||
.long("select-bg-color")
|
||||
.default_value("black"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("reverse")
|
||||
.help("Reverse the order for assigned hints")
|
||||
@ -131,6 +137,8 @@ fn main() {
|
||||
let hint_background_color = colors::get_color(args.value_of("hint_background_color").unwrap());
|
||||
let select_foreground_color =
|
||||
colors::get_color(args.value_of("select_foreground_color").unwrap());
|
||||
let select_background_color =
|
||||
colors::get_color(args.value_of("select_background_color").unwrap());
|
||||
|
||||
let command = args.value_of("command").unwrap();
|
||||
let upcase_command = args.value_of("upcase_command").unwrap();
|
||||
@ -155,6 +163,7 @@ fn main() {
|
||||
contrast,
|
||||
position,
|
||||
select_foreground_color,
|
||||
select_background_color,
|
||||
foreground_color,
|
||||
background_color,
|
||||
hint_foreground_color,
|
||||
|
11
src/view.rs
11
src/view.rs
@ -12,6 +12,7 @@ pub struct View<'a> {
|
||||
contrast: bool,
|
||||
position: &'a str,
|
||||
select_foreground_color: Color,
|
||||
select_background_color: Color,
|
||||
foreground_color: Color,
|
||||
background_color: Color,
|
||||
hint_background_color: Color,
|
||||
@ -26,6 +27,7 @@ impl<'a> View<'a> {
|
||||
contrast: bool,
|
||||
position: &'a str,
|
||||
select_foreground_color: Color,
|
||||
select_background_color: Color,
|
||||
foreground_color: Color,
|
||||
background_color: Color,
|
||||
hint_foreground_color: Color,
|
||||
@ -39,6 +41,7 @@ impl<'a> View<'a> {
|
||||
contrast: contrast,
|
||||
position: position,
|
||||
select_foreground_color: select_foreground_color,
|
||||
select_background_color: select_background_color,
|
||||
foreground_color: foreground_color,
|
||||
background_color: background_color,
|
||||
hint_foreground_color: hint_foreground_color,
|
||||
@ -117,6 +120,11 @@ impl<'a> View<'a> {
|
||||
} else {
|
||||
self.foreground_color
|
||||
};
|
||||
let selected_background_color = if selected == Some(mat) {
|
||||
self.select_background_color
|
||||
} else {
|
||||
self.background_color
|
||||
};
|
||||
|
||||
// Find long utf sequences and extract it from mat.x
|
||||
let line = &self.state.lines[mat.y as usize];
|
||||
@ -130,7 +138,7 @@ impl<'a> View<'a> {
|
||||
mat.y as usize,
|
||||
rustbox::RB_NORMAL,
|
||||
selected_color,
|
||||
self.background_color,
|
||||
selected_background_color,
|
||||
&text,
|
||||
);
|
||||
|
||||
@ -227,6 +235,7 @@ mod tests {
|
||||
contrast: false,
|
||||
position: &"",
|
||||
select_foreground_color: rustbox::Color::Default,
|
||||
select_background_color: rustbox::Color::Default,
|
||||
foreground_color: rustbox::Color::Default,
|
||||
background_color: rustbox::Color::Default,
|
||||
hint_background_color: rustbox::Color::Default,
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source ~/.bash_profile
|
||||
[ -f ~/.bash_profile ] && source ~/.bash_profile
|
||||
|
||||
PARAMS=()
|
||||
|
||||
@ -36,6 +36,7 @@ add-option-param "bg-color"
|
||||
add-option-param "hint-bg-color"
|
||||
add-option-param "hint-fg-color"
|
||||
add-option-param "select-fg-color"
|
||||
add-option-param "select-bg-color"
|
||||
add-option-param "command"
|
||||
add-option-param "upcase-command"
|
||||
add-multi-param "regexp"
|
||||
|
Loading…
Reference in New Issue
Block a user