ogham / rust-ansi-term

Rust library for ANSI terminal colours and styles (bold, underline)

Home Page:https://crates.io/crates/ansi_term

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a helper to switch colors to their `intense` variant

yaahc opened this issue · comments

related to this issue in color-eyre where it was reported that colors are particularly dark on Windows eyre-rs/color-eyre#12

The color-backtrace crate which color-eyre depends on fixes this issue by using intense variants of colors, according to termcolor, which are the 8-15 colors instead of the standard 0-7 colors. I think it makes sense to add a helper function on Color that will change a Color to its intense version if applicable.

Is this related to how I can't get "bright" colors without using the bold() function?

If so, yes please. I want the bright/intense colors without setting the font to bold.

@cjbottaro Just FYI, you get bright colors when using the bold function only because some terminals have "Use bright colors for bold text" enabled which might not always be the case. If you really want consistent bright colors, you can use 256 colors with the Color::Fixed.

If you really want consistent bright colors, you can use 256 colors with the Color::Fixed.

Using the 256 color pallete has some disadvantages:

  • If the user has changed the colors in their terminal, using the 256 color pallette won't respect their color settings.
  • It seems unlikely there are too many terminal emulators that don't support 256 color escape codes, but it's a possibility.

nu-ansi-term supports Color::LightRed to get a bright red using the standard 16-color pallette. I don't know of a way to do it in this crate though. :(