ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
6.64k stars 399 forks source link

Document how to enable truecolor on Windows #135

Closed MichaelGoulding closed 3 years ago

MichaelGoulding commented 3 years ago

The code looks for the environment variable

COLORTERM

to enable true color.

Windows 10 has supported true color in the console for a while now, but FTXUI doesn't do the right thing without the environment variable set:

image

ArthurSonzogni commented 3 years ago

I am sorry this terminal on Windows doesn't set the COLORTERM variable.

Maybe there is a standard ways in the terminal specification: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html to query directly the terminal support for colors.

The cost would be some communication with the terminal via stdin/stdout, before starting. This is a bit annoying, because user's might want to send/receive some data via this channel. I guess we need something user's can call when they need it.

Maybe

ftxui::QueryColorSupport()
ftxui::OverrideSupportedColor(color_mode)

that would query the terminal its supported colors and wait for a reply. It can store the results to:

Terminal::Color cached_supported_color;

https://github.com/ArthurSonzogni/FTXUI/blob/master/src/ftxui/screen/terminal.cpp#L50

It's quite hard for me test on Windows. Feel free to submit PR if you can, otherwise, I will try it, but this might take me some time.

ArthurSonzogni commented 3 years ago

Hey @MichaelGoulding,

Do you think we should close this issue, given the latest patch?