It's not possible to set the color to "default" within `with`
LukasKalbertodt opened this issue · comments
Lukas Kalbertodt commented
Consider this:
Color::Red.with(||{
println!("Red {} Red", Color::Normal.paint("Normal"));
});
One wants to reset the color to default within a with
block. The code above prints all three words in red. One should be able to somehow reset it.
Lukas Kalbertodt commented
Resetting just the foreground color is not easy. You have to reset the whole terminal and reapply the attributes that should be preserved. There should be a method like reset_fg
, but Color::Normal
shouldn't do that implicitly.
A note in the documentation was added.