Elixir: IEx colors should be disabled on Windows by default

Created on 27 Jun 2013  路  14Comments  路  Source: elixir-lang/elixir

IEx Bug Windows

Most helpful comment

If anyone reaches this thread because you want to enable colors when you run elixir some_tests.exs, please do notice that you need to use ExUnit.start(colors: [enabled: true])

I am using Windows 10, integrated terminal in vscode, but I couldn't get the test colors neither in cmder nor cmdemu. I came across this read this remark in Elixir development on Windows 10.

I hope this saves time to someone. Keep up the good work.

All 14 comments

Hi guys! What I need to do to enable IEx colors on Windows?

@AlbertMoscow

IEx.Options.set :colors, enabled: true

You can put this line in your .iex file. Make sure you're running iex in a terminal that supports ANSI escape sequences.

Need more help... I downloaded ANSI escape sequences supporting terminal from here:
http://linge-ma.ws/2011/08/better-cmd-exe-terminal-and-ansi-color-codes-support/

And here is my screenshot:
terminal

Does mix new foo generate the proper output with colors?

  1. If yes, colors won't work in iex because of the tty emulation
  2. If not, your ANSII setup is not working

@AlbertMoscow Maybe this can help?

Finally, to achieve the best possible console experience on Windows we鈥檙e going to add Console2 to the chain. The end result will be Ansicon wrapping Console2, which is wrapping Git Bash, which is wrapping the Windows Console. It鈥檚 not elegant but it works great, and seems to be the best solution I鈥檝e come accross.

@josevalim, could you please take screenshots of IEx and mix new on your Mac and paste them here so I could realize what beauty I am missing on my Windows? :)

screen shot 2013-07-15 at 10 05 54 pm

Alexei, Jos茅, thank you!

I like colors on Mac! :) Here are colors on Windows:

console2

Hi! As some may experience troubles with Ansicon or other windows ANSI emulators, here's an alternative that seems quite stable: Cmder
cmder

ConEmu also works well (and has far more features, older, stable, etc...), been using console colors (enabled via my .iex file for a long while now) if anyone comes across this.
image

@OvermindDL1 Yep. P.S. Cmder is a wrapper around ConEmu

@OvermindDL1 Yep. P.S. Cmder is a wrapper around ConEmu

@d-led Ahh, really? I may have to look at that then, thanks!

P.S. the Windows 10 console implements ANSI colors:

image

to enable colorization by default on windows, the following SO answer helps

If anyone reaches this thread because you want to enable colors when you run elixir some_tests.exs, please do notice that you need to use ExUnit.start(colors: [enabled: true])

I am using Windows 10, integrated terminal in vscode, but I couldn't get the test colors neither in cmder nor cmdemu. I came across this read this remark in Elixir development on Windows 10.

I hope this saves time to someone. Keep up the good work.

Was this page helpful?
0 / 5 - 0 ratings