cpp-terminal icon indicating copy to clipboard operation
cpp-terminal copied to clipboard

The color chart in ./colors seems incorrect on macOS

Open certik opened this issue 3 years ago • 7 comments

On macOS it looks like this:

Screen Shot 2021-03-08 at 11 30 52 AM

certik avatar Mar 08 '21 18:03 certik

hmm interesting... have you checked on what macos is supporting and what not? Maybe even tried a different terminal like kitty? It could be possible that the default macos terminal is not supporting true color at all.

MCWertGaming avatar Mar 08 '21 19:03 MCWertGaming

Yes, I'll try to investigate later. I reported it so that we don't forget.

certik avatar Mar 08 '21 21:03 certik

I have checked on that. There are some people who are writing that the Terminal.app (macos term) can 24bit colors but that seems to be wrong. https://gist.github.com/XVilka/8346728 this gist lists it as unsupported there as well.

I would suggest to Implement a function for converting 24bit to 8bit / 4bit. When we have all required functions for testing color support on runtime, we can simply write an "Translator" that converts our true colors to 4/8 bit ones. There are already good examples out there.

We could think about the merging of Window and Window_24bit here as well. I think that we could do that by only initializing the RGB vector if true color is used. If it is, we would basically check if the terminal supports 24bit colors. If not we just convert rgb to 4bit but skip storing it into the rgb vector. If the terminal has rgb support we would just store and use the rgb colors without the 4bit ones.

If almost all terminals are supporting 8bit colors though, we could just do a conversion from 24bit to 8bit, that would be easier and would look closer to the original.

Color support can be found via $COLOTERM variable on linux, on windows it's depending on what system version as CMD (converts), powershell and the microsoft terminals are supporting true colors since windows 10. But kitty terminal for example offers true color on windows 7 / 8 as well.

Also we would have to test the most common terminals on linux as not all are settimg the $COLORTERM var the same way. Unix would be another thing in the end, but its default term is not supporting true color and i have never tested that.

Also i would like to test some rather uncommon terminal as well, like Termux, nhterminal, TWRP terminal (all android) and the default ones of linux DE's / unix distributions (BSD). Also armv7/armv8/aarch64 (raspberry pi) would be a good thing.

MCWertGaming avatar Mar 09 '21 10:03 MCWertGaming

I would create a branch here inside of the upstream repository of cpp-terminal and start on a linux implementations of such checks. That shouldn't be too hard. Will you check on the same on macos? I have never used it, but i know that it's really similar to linux (even though a slightly different unix kernel) so it would probably the same as on linux. Windows will be a bit tricky but we will find a solution there as well. As there are not many people that are using windows console except for development / debugging (which is done in CMD usually) I think it would be enaugh to support CMD and Powershell 5/7 (7 is powershell core, the new shell but it's not installed by default). Which means that we could just skip those checks or do something like a operating system version check and disable true color on windows < 10 (most likely 8.1/8/7, i hope that no one is creating software for lower than that anymore).

Also how do you test macos? Do have a mac book or are you running it inside of a VM?

MCWertGaming avatar Mar 10 '21 08:03 MCWertGaming

I have access to both Intel and Arm macOS to test. Just submit a PR with your addition, we'll keep the PR open. Make sure you allow edits from maintainers. We don't have to fix everything at once --- let's get started on a subset, merge, improve etc.

certik avatar Mar 10 '21 16:03 certik

Sure!

MCWertGaming avatar Mar 10 '21 19:03 MCWertGaming

Implemented in #191, but needs verification on macos. @certik would you mind testing this again?

MCWertGaming avatar Sep 16 '22 18:09 MCWertGaming