leiningen icon indicating copy to clipboard operation
leiningen copied to clipboard

ANSI Colors on Windows

Open wekempf opened this issue 5 years ago • 1 comments

Various plugins use ANSI escape codes to display colored text, which on Windows fails and just displays garbage characters. Some of these tools (like cljsbuild) suggest you install ansicon as a work around. However, on Win10 ANSI escape codes are actually supported. To prove this, open a PowerShell windows and enter the following:

PS> "$([char]27)[32mSuccessfully compiled [`"target/cljsbuild/public/js/app.js`"] in 28.163 seconds.$([char]27)[0m"

That's actually the output string from cljsbuild and it properly will display with green text.

So, why doesn't "lein cljsbuild once min" produce that message in green text, instead outputting the escape characters? Because, right now unfortunately, this is an opt-in feature that requires the program to call SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING. So, if lein were to call that there'd be no need for ansicon. Any chance this could happen?

wekempf avatar Aug 24 '18 19:08 wekempf

Sure; feel free to submit a patch for that.

technomancy avatar Sep 20 '18 21:09 technomancy