diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-05-17 18:19:57 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-05-22 13:57:52 -0400 |
commit | f08effc46de52655c8431498c6bc214c0eda30e5 (patch) | |
tree | 4fd806d5199b42f3ce77c87050795f59408b1a24 /src/paint.rs | |
parent | 54da480bd0465daf698f2566c454e0921110d69c (diff) |
Introduce style strings to replace color options
https://git-scm.com/docs/git-config#Documentation/git-config.txt-color
- Support "syntax" pseudo foreground color
- Delete the --syntax-highlight CLI option
This was never released.
Diffstat (limited to 'src/paint.rs')
-rw-r--r-- | src/paint.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/paint.rs b/src/paint.rs index 2b9969eb..f3ebf9de 100644 --- a/src/paint.rs +++ b/src/paint.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use ansi_term; use syntect::easy::HighlightLines; -use syntect::highlighting::{Color, Style, StyleModifier}; +use syntect::highlighting::{Color, FontStyle, Style, StyleModifier}; use syntect::parsing::{SyntaxReference, SyntaxSet}; use crate::bat::terminal::to_ansi_color; @@ -223,6 +223,15 @@ pub fn to_ansi_style(style: Style, true_color: bool) -> ansi_term::Style { if style.foreground != style::NO_COLOR { ansi_style = ansi_style.fg(to_ansi_color(style.foreground, true_color)); } + if style.font_style.contains(FontStyle::BOLD) { + ansi_style.is_bold = true; + } + if style.font_style.contains(FontStyle::ITALIC) { + ansi_style.is_italic = true; + } + if style.font_style.contains(FontStyle::UNDERLINE) { + ansi_style.is_underline = true; + } ansi_style } |