Skip to content

Commit

Permalink
fix(anstyle-termcolor): set effect correctly for transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Sep 12, 2023
1 parent 1f403ae commit d64f669
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions crates/anstyle-termcolor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,10 @@ pub fn to_termcolor_spec(style: anstyle::Style) -> termcolor::ColorSpec {
let mut style = termcolor::ColorSpec::new();
style.set_fg(fg);
style.set_bg(bg);
if effects.contains(anstyle::Effects::BOLD) {
style.bold();
}
if effects.contains(anstyle::Effects::DIMMED) {
style.dimmed();
}
if effects.contains(anstyle::Effects::ITALIC) {
style.italic();
}
if effects.contains(anstyle::Effects::UNDERLINE) {
style.underline();
}
style.set_bold(effects.contains(anstyle::Effects::BOLD));
style.set_dimmed(effects.contains(anstyle::Effects::DIMMED));
style.set_italic(effects.contains(anstyle::Effects::ITALIC));
style.set_underline(effects.contains(anstyle::Effects::UNDERLINE));
style
}

Expand Down

0 comments on commit d64f669

Please sign in to comment.