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
[Console] Add Ansi8 (256 color) support, improve true color (Ansi24) support detection #46944
Conversation
julien-boudry
commented
Jul 14, 2022
Q | A |
---|---|
Branch? | 6.2 for features |
Bug fix? | no |
New feature? | yes |
Deprecations? | no |
License | MIT |
- Refactor the detection code of the colorimetric capacities of the terminal (much easier to extend next)
- Improve true color terminal detection according to https://github.com/termstandard/colors/
- Add detection for 256 colors terminal (Ansi8 support) and add the conversion from true color (Ansi24) to it. This is especially useful for the Apple Terminal which is still deployed by default in 2022, but not only.
Hey! I think @CupOfTea696 has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
In pratice:
|
4d7092c
to
e0ea32e
Compare
7f8f760
to
aaa3f37
Compare
Note: @fabpot fabbot.io doesn't like Enum with methods. And not also empty line before doc. comments on |
I will change the enum name soon as discussed. Add one more test. And Squash all these commits at the end. And possibly, we will be perfect. |
922741b
to
cfaffa0
Compare
…improves terminal support detection (Ansi4, Ansi8, Ansi24) * The detection of terminal capabilities is always conservatively estimated, without speculation that may result in display errors. But significantly improved, bringing in particular 256 colors compatibility with Apple Terminal (instead of 8). * Ansi8 is used by converting the RGB hexadecimal to the nearest color. * The whole corresponding code is refactored and many tests are added for both existing and new features.
…improves terminal support detection (Ansi4, Ansi8, Ansi24) * The detection of terminal capabilities is always conservatively estimated, without speculation that may result in display errors. But significantly improved, bringing in particular 256 colors compatibility with Apple Terminal (instead of 8). * Ansi8 is used by converting the RGB hexadecimal to the nearest color. * The whole corresponding code is refactored and many tests are added for both existing and new features.
Thank you @julien-boudry. |
…lor Mode (julien-boudry) This PR was merged into the 6.2 branch. Discussion ---------- [Console] Terminal Color Mode refactoring and force Color Mode | Q | A | ------------- | --- | Branch? | 6.2 for features | Bug fix? | no | New feature? | yes | Deprecations? | no | License | MIT Continue #46944 Terminal Color Mode refactoring: Adding a way to force color mode by the dev. user (with a new method), fewer `getenv()` calls (cache value), simpler tests (use the a new method and a new constant). For example, it can be useful in an environment where none of the expected environment variables are available (Docker container...) , but where the support of a specific mode is imperative. A future evolution could be to add an optional default option to all commands to force a particular mode by the final user. Commits ------- 4cb8384 [Console] Terminal Color Mode refactoring: Adding a way to force color mode by user, fewer getenv() calls, simpler tests.