Skip to content

Commit 96be3a7

Browse files
authored
Merge pull request #24 from m42e/color-support
Respect environment variable for colors
2 parents 673c65f + f142d97 commit 96be3a7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/environment.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ pub fn get_default_tab() -> Location {
7373
_ => Location::Session,
7474
}
7575
}
76+
77+
pub fn get_color() -> String {
78+
let color = env::var("HISTDB_COLOR").unwrap_or(String::from("auto"));
79+
return color.to_string();
80+
}

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ fn show_history(thequery: String) -> Result<String, String> {
9393
loop {
9494
let title = generate_title(&location);
9595
let window_option = get_preview_window_option();
96+
let color_options = get_color();
9697

9798
let options = SkimOptionsBuilder::default()
9899
.height(Some("100%"))
99100
.multi(false)
100101
.reverse(true)
101102
.prompt(Some("history >>"))
102103
.query(Some(&query))
104+
.color(Some(&color_options))
103105
.bind(vec![
104106
"f1:abort",
105107
"f2:abort",

0 commit comments

Comments
 (0)