I've recently started doing some ruby on rails development on Windows 7 and have found a number of commands (rspec, guard, etc) output colour codes that just show up in text on the windows command line (or through Console2 which I use). eg:
←[31mrspec ./spec/views/users/index.html.erb_spec.rb:21←[0m ←[36m# users/index renders a list of users←[0m
←[31mrspec ./spec/requests/homes_spec.rb:9←[0m ←[36m# Homes GET /homes ←[0m
←[31mrspec ./spec/views/users/new.html.erb_spec.rb:13←[0m ←[36m# users/new renders new user form←[0m
←[31mrspec ./spec/views/users/show.html.erb_spec.rb:13←[0m ←[36m# users/show renders attributes in <p>←[0m
I'm aware you can turn the color off for most tools by taking the --color
command out out of the config files (e.g. the .respc file), but it's a pain to have to do this for everything and colour coding would be nice.
Any ideas how I can get these to display properly in Windows?
To set the default Command Prompt window color, select the upper-left corner of the Command Prompt window, select Defaults, select the Colors tab, and then select the colors that you want to use for the Screen Text and Screen Background.
Type the command – color /? in the Command Prompt. It sets the default console foreground and background colors. COLOR [attr] attr - Specifies the color attribute of console output. First corresponds to the background.
To use ANSI colours in the Windows terminal requires setting VirtualTerminalLevel. VirtualTerminalLevel = 1 is now set by default for the terminal and in ConPTY. Alternatively it can be enabled by calling the SetConsoleMode API with the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag.
Change Console2 to ConEmu (I'm the author of this console). It supports Ansi x3.64
Or, you may use AnsiCon to enable Ansi
I use Console2 ( http://sourceforge.net/projects/console/ ) with ansicon ( https://github.com/adoxa/ansicon ) and it work well :
ansicon -i
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With