How do I get 256 colors?

4,181 views
Skip to first unread message

ChrisBuchholz

unread,
Dec 11, 2010, 4:15:46 PM12/11/10
to iterm2-discuss
Hi guys,

How would I go about getting iTerm 2 to use 256 colors?
I have tried setting the "Report Terminal type" to `xterm-256color` in
Preferences -> Bookmarks -> Default profile (which i use) -> Terminal,
but it doesn't seem to work.

I should say, that the way I am testing that I am not getting 256
colors, is simply by looking at the colors when I open Vim and irssi
in iTerm 2 and comparing the colors to what I get on Debian Lenny and
Fedora 14. A guess would be, that I am getting something more like 8
colors, not the 256 I am going for.

Are iTerm 2 simply not supporting 256 colors, or do I need to change
some preference or something?


Thank you,
Chris Buchholz

George Nachman

unread,
Dec 12, 2010, 1:27:30 PM12/12/10
to iterm2-...@googlegroups.com
It definitely supports 256 colors. Usually setting your terminal type
is sufficient. Perhaps your .bashrc or .profile is overriding it? Try
logging on to a different host.

On Saturday, December 11, 2010, ChrisBuchholz

Martin Lundberg

unread,
Dec 12, 2010, 1:43:26 PM12/12/10
to iterm2-...@googlegroups.com
Hi Chris!


-Martin

Paul Biggar

unread,
Dec 12, 2010, 11:44:41 AM12/12/10
to iterm2-...@googlegroups.com
On Sat, Dec 11, 2010 at 1:15 PM, ChrisBuchholz
<christoffe...@gmail.com> wrote:
> How would I go about getting iTerm 2 to use 256 colors?
> I have tried setting the "Report Terminal type" to `xterm-256color` in
> Preferences -> Bookmarks -> Default profile (which i use) -> Terminal,
> but it doesn't seem to work.

256 colours works for me, and is the major reason I use iTerm/iTerm2
(trying to use 256 colours in Mac Terminal makes things blink; ie when
using a vim theme which uses more than the default 8 colours).

I have TERM=xterm-256colour set in my shell, and use a variation of
the desert theme. If you try that, and it doesn't flash, then it's
probably 256 colours.

Paul


--
Paul Biggar
paul....@gmail.com

Bill Moritz

unread,
Dec 13, 2010, 12:21:03 PM12/13/10
to iterm2-...@googlegroups.com
Did you install the ncurses-term package in debian? Not sure what the package name is on Fedora.

christoffe...@gmail.com

unread,
Dec 13, 2010, 1:29:14 PM12/13/10
to iterm2-...@googlegroups.com
Thanks for your answers, and sorry for the late reply.
Just wanna note, that I host my "dotfiles" on git, so both my .bashrc
and .vimrc can be found here:
https://github.com/ChrisBuchholz/dotfiles


On Sun, Dec 12, 2010 at 7:27 PM, George Nachman <gnac...@llamas.org> wrote:
> It definitely supports 256 colors. Usually setting your terminal type
> is sufficient. Perhaps your .bashrc or .profile is overriding it? Try
> logging on to a different host.
>
> On Saturday, December 11, 2010, ChrisBuchholz
> <christoffe...@gmail.com> wrote:
>> Hi guys,
>>

>> How would I go about getting iTerm 2 to use 256 colors?
>> I have tried setting the "Report Terminal type" to `xterm-256color` in
>> Preferences -> Bookmarks -> Default profile (which i use) -> Terminal,
>> but it doesn't seem to work.
>>

>> I should say, that the way I am testing that I am not getting 256
>> colors, is simply by looking at the colors when I open Vim and irssi
>> in iTerm 2 and comparing the colors to what I get on Debian Lenny and
>> Fedora 14. A guess would be, that I am getting something more like 8
>> colors, not the 256 I am going for.
>>
>> Are iTerm 2 simply not supporting 256 colors, or do I need to change
>> some preference or something?
>>
>>
>> Thank you,
>> Chris Buchholz
>

I tried the other host things - didnt give me any other result. I dont
think my .bashrc overrides anything it shouldn't. You can see my
.bashrc here: https://github.com/ChrisBuchholz/dotfiles/blob/master/.bashrc

The colortest script does indeed seem to show 256 colors, so I dont
get what is wrong. I can just tell, that the colors I get with Debian
Lenny or MacVim is different than those of iTerm with vim. Although,
after looking closer and googling a bit, it seems there can be
differences. I should also say, that I dont get the same result with
Gnome-terminal on Debian Lenny vs MacVim or GVim. So maybe vim
actually shows the correct colors? I dunno. For definetly, though, GNU
Screen and irssi is definetly not showing 256 colors. With irssi, its
neither when i run it inside or out of screen. When i take a look at
irssi, i can only count seven different colors, and that is including
white, grey and black. Maybe GNU Screen and irssi is not compiled with
256 colors?

I tried that, but it didnt give me any different result. But its
definetly nice to have in my .bashrc - I also use something similar in
the .bashrc I have on my debian lenny install to get 256 colors to
work :P

George Nachman

unread,
Dec 13, 2010, 4:23:01 PM12/13/10
to iterm2-...@googlegroups.com
The best way I've found to verify that vim is doing 256 colors is with vimdiff, which looks radically different with 256 colors. Try creating two files called "foo" and "bar" that have a few differences from each other and then run "vimdiff foo bar". If it still doesn't look like 256 colors, then do this:

screen 256colorbug.txt
cat .vimrc
set
vimdiff foo bar
:qa!
exit

(the 'set' command is there so I can see your environment variables)

And open a new bug attaching 256colorbug.txt to it. I'm on vacation now but I'll look at it when I get home.

christoffe...@gmail.com

unread,
Dec 13, 2010, 2:15:25 PM12/13/10
to iterm2-...@googlegroups.com

No i didnt. On ubuntu it seemed i should at one i tried, but not on debian and fedora.

Rainer Müller

unread,
Dec 14, 2010, 4:19:47 AM12/14/10
to iterm2-...@googlegroups.com
There is a typo below:

On 2010-12-13 22:23 , George Nachman wrote:
> screen 256colorbug.txt

script 256colorbug.txt

> cat .vimrc
> set
> vimdiff foo bar
> :qa!
> exit

Stop answering mails and enjoy your stay, George! ;-)

Rainer

George Nachman

unread,
Dec 14, 2010, 12:50:05 PM12/14/10
to iterm2-...@googlegroups.com
Yes, I meant script, not screen. Back to the beach :) 

yokull

unread,
Dec 22, 2010, 7:39:51 AM12/22/10
to iterm2-discuss
i'm having a similar issue
in terminal.app, i get the full spectrum and shades
but in iterm/iterm2, i'm not getting the complete spectrum

in terminal.app, i'm using xterm-color
and in iterm2 i'm using xterm-256color
to me, it appears that the "basic colors" or "ansi colors bright" are
being used, but not the "ansi colors normal" set (unsure if that makes
any sense...)

thnx

On Dec 11, 1:15 pm, ChrisBuchholz <christoffer.buchh...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages