1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-10-03 18:42:28 +01:00

add line highlight

This commit is contained in:
Taylor
2018-10-09 22:25:33 -06:00
parent 5842d58c01
commit 1a6709c2cb
4 changed files with 38 additions and 2 deletions

View File

@@ -18,8 +18,9 @@ pub fn as_terminal_escaped(
text: &str,
true_color: bool,
colored: bool,
background_color: Option<highlighting::Color>,
) -> String {
let style = if !colored {
let mut style = if !colored {
Style::default()
} else {
let color = to_ansi_color(style.foreground, true_color);
@@ -35,5 +36,6 @@ pub fn as_terminal_escaped(
}
};
style.background = background_color.map(|c| to_ansi_color(c, true_color));
style.paint(text).to_string()
}