mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-22 15:53:29 +01:00
Support combination of multiple styles at the same time
Old version of the code did not allowed for `bold italic` or `bold underline` styles
This commit is contained in:
parent
7155f76963
commit
4021cf8128
@ -34,17 +34,17 @@ pub fn as_terminal_escaped(
|
||||
let mut style = if !colored {
|
||||
Style::default()
|
||||
} else {
|
||||
let color = to_ansi_color(style.foreground, true_color);
|
||||
|
||||
let mut color = Style::from(to_ansi_color(style.foreground, true_color));
|
||||
if style.font_style.contains(FontStyle::BOLD) {
|
||||
color.bold()
|
||||
} else if style.font_style.contains(FontStyle::UNDERLINE) {
|
||||
color.underline()
|
||||
} else if italics && style.font_style.contains(FontStyle::ITALIC) {
|
||||
color.italic()
|
||||
} else {
|
||||
color.normal()
|
||||
color = color.bold();
|
||||
}
|
||||
if style.font_style.contains(FontStyle::UNDERLINE) {
|
||||
color = color.underline();
|
||||
}
|
||||
if italics && style.font_style.contains(FontStyle::ITALIC) {
|
||||
color = color.italic();
|
||||
}
|
||||
color
|
||||
};
|
||||
|
||||
style.background = background_color.map(|c| to_ansi_color(c, true_color));
|
||||
|
Loading…
Reference in New Issue
Block a user