Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strategy to handle terminals without 24bit support #33

Closed
sharkdp opened this issue Jul 14, 2019 · 1 comment
Closed

Strategy to handle terminals without 24bit support #33

sharkdp opened this issue Jul 14, 2019 · 1 comment

Comments

@sharkdp
Copy link
Owner

sharkdp commented Jul 14, 2019

We distinguish 3 modes:

  • no color
  • 8 bit mode (\x1b[38;5;167m)
  • 24 bit mode, aka "true color" (\x1b[38;2;255;0;127m)

Note that we ignore the 16-color ANSI mode, as we can't really predict how the 16 colors look like.

We choose the mode in the following way:

  • If --mode=24bit or --mode=8bit => use the given mode.
  • Otherwise, if the output goes to a non-interactive terminal => use no color mode
  • Otherwise, if PASTEL_MODE=8bit, use 8 bit mode
  • Otherwise, if PASTEL_MODE==24bit or COLORTERM==truecolor or COLORTERM==24bit => use 24 bit mode
  • Otherwise, use 8 bit mode and show a warning.

Further literature: https://gist.github.com/XVilka/8346728

@sharkdp sharkdp added this to the Initial release milestone Jul 14, 2019
@sharkdp
Copy link
Owner Author

sharkdp commented Jul 18, 2019

This can now be easily done with ansi::Brush

@sharkdp sharkdp changed the title Add --mode option Strategy to handle terminals without 24bit support Jul 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant