Enable 256 colors for cygwin under mintty?

20

5

I am using cygwin via mintty, which is the default. I installed ncurses. I then run these commands to see what my color pallet is for this terminal session:

$ tput colors
8

I have googled but so far nothing. How can I get a nice 256 color palette for my mintty cygwin terminal instead of the default (lame) 8 colors?

Zombies

Posted 2014-04-02T15:53:43.360

Reputation: 3 214

If you use mintty, you can apparently set the terminal type to xterm-256... – CMCDragonkai – 2014-06-04T01:11:06.280

Answers

21

Try export TERM=xterm-256color or equivalent. You can add that to the appropriate dotfile if you want it to be persistent. You can use a 256-color demo script like this to verify functionality.

jjlin

Posted 2014-04-02T15:53:43.360

Reputation: 12 964

This worked for me too. But I can't get it to work over SSH to Windows from my Mac iTerm2. It does work with the same settings when I SSH to an Ubuntu box. – Sridhar Sarnobat – 2014-11-19T05:06:55.657

2A "dotfile" being any file starting with a dot, I would at least advise to NOT set TERM variable in dotfiles that are related to your shell, as opposed to dotfiles related to your terminal emulator program. This is because a shell may be used with multiple terminal emulators, and setting TERM there is obviously a misplacement mistake, an all too common one I am afraid. If you are going to override TERM value, the proper place to do so is not in a shell dotfile, but a terminal emulator dotfile, if there is one, in this case something like ~/.minttyrc. I hope I have made myself clear. – amn – 2015-05-21T10:53:02.253

1So if in mintty I have TERM set to xterm-256color and I run that script and I only get some very slow output of solid black lines, what does that mean I should do about fixing it? tput colors tells me 256. – dlamblin – 2015-10-26T20:45:52.357

6

Worked, thanks: http://i.imgur.com/MKlwTGK.png

– Zombies – 2014-04-03T14:48:18.783

29

Right-click in mintty, then in Options...->Terminal, change type to xterm-256color, click OK, close mintty and re-launch it.

Yaakov

Posted 2014-04-02T15:53:43.360

Reputation: 733

1It's also Term=xterm-256color in .minttyrc. Anyway this should be the right answer for Cygwin mintty – wbkang – 2017-06-03T20:29:52.230