28 Jun 2013, 11:50
Nickparsons_pragsmall

Nicholas Parsons (4 posts)

Greetings,

I just downloaded and installed the latest version of elixir and erlang on my windows 7 machine and everything went well until I ran the 3 + 7 example on page 4 in the PDF version of the book from iex launched from the command prompt. It gave the correct answer of 10 but also produced some extraneous output “[33m10[0m”. When I typed 5 * 5 I got back “[33m25[0m”. Has anyone experienced the same thing? I installed version 0.9.3 of elixir.

Any feedback is welcome…

Thanks in advance! –Nick

28 Jun 2013, 18:13
Generic-user-small

Edward McDowell (5 posts)

You are seeing ANSI escape sequences which are supposed to display the enclosed text in color. On Windows you may disable this feature by creating a file named .iex in your home directory (C:\Users\Username) with the following content:

IEx.Options.set(:colors, [enabled: false])

See the subsection “Customizing iex” on page 7 of the ebook.

29 Jun 2013, 15:08
Nickparsons_pragsmall

Nicholas Parsons (4 posts)

Hi Edward,

That makes sense, thanks for your help!

Regards, –Nick

04 Jul 2013, 17:35
Itsme_pragsmall

Mark Davis (2 posts)

Hi, On windows you can install https://github.com/adoxa/ansicon to display colours in the shell. Seems to work very well with iex but will also give you colours for any other program that uses similar (eg cucumber)

03 Nov 2014, 22:21
Generic-user-small

seadynamic8 (7 posts)

For me, I had to do the following:

  • Explicitly enable the colors, for both ExUnit (Testing) and for iex.

For iex (You can configure the other colors too):

IEx.configure colors: [ enabled: true, eval_result: [ :cyan, :bright ] ]

For ExUnit (test\test_helper.exs - Under a mix project):

ExUnit.start(colors: [enabled: true])

Otherwise, with mix, you can also you use:

mix test --color

If you use ConEmu as a terminal, you don’t have to include ansicon, otherwise if you use the default terminal or something like ConsoleZ, Console2, it is needed.

Hope that helps anyone having trouble getting colors to work on Windows.

Jarvis

05 Nov 2014, 15:13
Lstor_avatar_pragsmall

Lars Storjord (6 posts)

My approach has been to use ansicon, Git Bash and Console2/Z, as explained by this guide. Works well for me, but I haven’t tried ConEmu.

  You must be logged in to comment