Closed Dragon1573 closed 2 years ago
According to termstandard/colors, I also installed MobaXterm on my device. But jp2a
still failed to show picture in true color.
jp2a
detects true color by inspecting the COLORTERM
environment variable. True color output is only enabled if this variable is set.
Some terminals do not set this variable even if the terminal actually supports true color.
I guess the test /d/24-bit-color.sh
is similar to this? This script does not test in a way that is programmatically detectable. It just prints some output to the console and the user has to confirm visually if the output looks like true color.
Solution:
You can force jp2a
to produce true color output regardless of the terminal with --color-depth=24
. This can be set as an alias in .bashrc
:
alias jp2a='jp2a --color-depth=24'
However --color-depth=24
implicitly enables color output. I suggest setting COLORTERM
in .bashrc
instead:
export COLORTERM='truecolor'
If there is a way to programmatically detect true color support that also works with Windows Terminal or Microsoft Bash Launcher that would be great and I would add it to jp2a
.
jp2a
detects true color by inspecting theCOLORTERM
environment variable. True color output is only enabled if this variable is set. Some terminals do not set this variable even if the terminal actually supports true color.
Oops?! I didn't know it before... When you mentioned this, I checked my Windows Terminal and it does NOT have this variable pre-configured.
- I guess the test
/d/24-bit-color.sh
is similar to this? This script does not test in a way that is programmatically detectable. It just prints some output to the console and the user has to confirm visually if the output looks like true color.
Now I get it. Windows Terminal DOES support True Color, but only users know it (by running the script). The terminal itself know nothing about it.
Solution: You can force
jp2a
to produce true color output regardless of the terminal with--color-depth=24
. This can be set as an alias in.bashrc
:alias jp2a='jp2a --color-depth=24'
NO. This solution is not worked on my device. Only add arguments with --color-depth=24
make no sense to the terminal.
However
--color-depth=24
implicitly enables color output. I suggest settingCOLORTERM
in.bashrc
instead:export COLORTERM='truecolor'
THIS SOLUTION IS WORKED! I have to add set -gx COLORTERM 'truecolor'
and export COLORTERM='truecolor'
to both Fish and Bash. Then no matter if I add the argument, jp2a
will use true color at anytime. You can try this
prompt> echo $COLORTERM
truecolor
prompt> jp2a --fill --colors --chars=' ' 'https://th.bing.com/th/id/OIP.q8A91hpnrVv1S3RxASDJyQHaEK?w=32
0&h=180&c=7&r=0&o=5&dpr=2.25&pid=1.7'
(A beautiful peafowl is shown, picture is as follows)
NO. This solution is not worked on my device. Only add arguments with --color-depth=24 make no sense to the terminal.
Sorry for the confusing wording, I meant that --color-depth=24
has to be added additionally, e.g.
jp2a --fill --colors --color-depth=24 --chars=' ' 'https://th.bing.com/th/id/OIP.q8A91hpnrVv1S3RxASDJyQHaEK?w=320&h=180&c=7&r=0&o=5&dpr=2.25&pid=1.7'
No effect of this command without COLORTERM
environment variable unset. I have to set the environment variable, then jp2a
will automatically turn into 24-bits mode without adding --color-depth=24
argument.
Hello @cslarsen, could you please do me a favour of enable true color support on WSL2? Does Windows Terminal Preview & Microsoft Bash Launcher actually support true color?
jp2a
can't detect it?/d/24-bit-color.sh
?Thank you!
Environments
Situations
Windows Terminal Preview
jp2a
failed to detect itScreenshots are folded (Click to expand)
![image](https://user-images.githubusercontent.com/49941141/161690752-3f0a9f31-36e7-4335-9c31-ed789f6b4d49.png) ![image](https://user-images.githubusercontent.com/49941141/161691196-ab137728-7ff6-429c-bbdd-c290c1cfd78f.png)Microsoft Visual Studio Code
jp2a
detected itScreenshots are folded (Click to expand)
![image](https://user-images.githubusercontent.com/49941141/161691643-b758683e-ff3c-47ea-bc0f-6891fea193eb.png) ![image](https://user-images.githubusercontent.com/49941141/161691937-d9f03885-3e78-450f-98f1-d57196894927.png)Microsoft Bash Launcher
I also launch
bash.exe
withWin + R
directly.jp2a
failed to detect itScreenshots are folded (Click to expand)
![image](https://user-images.githubusercontent.com/49941141/161692662-d2c9288b-13bc-47da-a487-90c8ad280402.png) ![image](https://user-images.githubusercontent.com/49941141/161692938-ddf1313e-a99c-4d26-a4ac-61405cbecaed.png)