Subject: Re: Is 256 colors possible with cmd.exe?
From: Andy Koppe <[email-masked]>
To: [email-masked]
Date: Fri, 23 Apr 2010 12:35:15 +0100
List-Id: <cygwin.cygwin.com>

Alex Leigh:
> So my question is, is it possible to get 256 colors
> with Cygwin running on top of cmd.exe?

As Corinna already said: nope. Windows represents console colours with
only four bits: red, green, blue, bright:
http://msdn.microsoft.com/en-us/library/ms682013%28v=VS.85%29.aspx

Only thing you can do is change the resulting 16 colours in the
console properties.

(A bit of pedantry: Cygwin programs don't run on top of cmd.exe; they
run in console windows. On Windows 7 those are managed by conhost.exe.
Cmd.exe is just another program that runs in a console window.)

> If this is not possible, then does anyone have any advice on ways to
> have compatibility with both Unix terminal features including 256
> color and Windows console programs within a single terminal app? The
> only solution of this sort I've found is conin.exe from the developers
> of mintty. It does provide half the solution in that it allows input
> to be piped from mintty to Windows console programs, but unfortunately
> it's not possible to see the output from those programs.

Conin isn't quite that useless. It works ok for programs that only
depend on stdin being a console, e.g. python, scala, and cmd.exe,
although there are quirks. With others such as the mysql client,
output does work, but you don't get a prompt because it checks whether
both stdin and stdout are consoles to decide whether to enter
interactive mode. Output will fail completely though when programs use
console-specific output functions, in particular WriteConsole and
WriteConsoleOutput.

Which programs are the problem cases for you?

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple