colored-rs / colored

(Rust) Coloring terminal so simple you already know how to do it !
Mozilla Public License 2.0
1.74k stars 84 forks source link

Windows Terminal supports truecolor, but colored doesn't detect that #180

Open spenserblack opened 1 month ago

spenserblack commented 1 month ago

See https://github.com/microsoft/terminal/issues/11057

We could either detect if Windows Terminal is running by checking if the WT_SESSION environment variable exists, or we could wait for Windows Terminal to set the COLORTERM variable.

spenserblack commented 1 month ago

BTW, when looking into this, I realized we support truecolor but not 256-color (I actually just recently realized they're 2 different things). See how GitHub's CLI detects support: https://github.com/cli/cli/blob/e6ff77ce73c201b0ee36d2b802ea45e9e1ad1822/pkg/iostreams/color.go#L36-L50

If it's worth doing, we could rename TrueColor to Rgb, and print the truecolor or 256-color escape sequence depending on support. If so, I can open a new issue.