简体   繁体   中英

How do you get the Windows Console \ Command Prompt to display color?

My problem is as follows:

I used to code on Linux (Ubuntu, to be more precise), but now I am using a Windows machine (7 and 8.1). One of the major caveats for me is that the Command Prompt in either Windows does not display other colors or font styles other than the default one, resulting in a monotone terminal.

This is useful for debugging Symfony projects (as errors have colors, making them easier to read) and more. This happens out of the box in the Linux terminal and wish to have the same behavior in Windows.

Is there a way to achieve this in the default Command Prompt (how?) or is there a 3-rd party application that achieves this (I've already tried PowerCMD but apparently it doesn't allow php to output to the console)?

I had the same problem and solved it by switching to another terminal. I Use "cmder" terminal for windows which supports all the color codes out of the box. Symfony3 console looks pretty much as the one you know from Linux.

Check out this comparison article: Comparison to other window terminal

Download cmder terminal from: cmder homepage

Cmder terminal comes with build in color themes for terminal window. The one below comes by default "Monokai", but if you like the standard look feel free to switch to "Ubuntu" or "xterm" theme (those are also build in themes - there are more themes available out of the box).

"Monokai" 在此处输入图片说明

"Ubuntu" 在此处输入图片说明

"xterm" 在此处输入图片说明

If you like transparency for active and inactive terminal window you can set it too (Settings shortcut -> "Ctrl + Alt + P").

As Symfony2 console component documentation says, windows doesn't support natively ANSI colors. You could install ANSICON as suggested there or you can try with cygwin , it has full shell support (bash or zsh) so you can have colors and many more things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM