Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Machine Info: Gentoo amd64 + bash

I've already tried to export the environment variable TERM to xterm-256color or screen-256color, and tput colors also returns 256. It looks like my terminal can support 256 colors.

I use vim with my favorite colorschema "jellybean" in 256color formatted. When I use the console on local machine, the font color appears really strangely like this: https://www.dropbox.com/s/klspl4ayeyraxwb/2013-03-23%2021.43.04.jpg ( Sorry post via url, I need 10 reputation to post image... )

But if I use my Macbook OSX terminal or putty on Windows to ssh back to my machine, the font color on vim works fine like this: https://www.dropbox.com/s/fmo4nfrj1ggdb7a/2013-03-23%2021.43.25.jpg

Does anyone else have this problem? Any help will be appreciated.

share|improve this question

migrated from stackoverflow.com Mar 26 '13 at 10:18

This question came from our site for professional and enthusiast programmers.

    
TERM is set in your terminal emulator's preferences but you neglected to say what terminal emulator you are using. Oh… are you using the tty console? It doesn't support 256 colors at all. –  romainl Mar 26 '13 at 7:37
    
do you mean the tty? when system is up and I type my username and password to login, I just export the TERM, and start to vim. I don't know what is my terminal... It is just default console I think... –  Chen OT Mar 26 '13 at 7:40

2 Answers 2

up vote 1 down vote accepted

You can't use a 256 colors colorscheme on the linux console because it simply doesn't support 256 colors.

It's limited to 8 basic colors + 8 "bright" versions of the 8 basics. If you really want to use the tty console, you'll need to use a more limited colorscheme adapted to 8/16 colors terminals.

share|improve this answer
    
Thanks! So... if I wanna use 256 colorschema on my local machine, is it right that I install another terminal emulator to use it? –  Chen OT Mar 26 '13 at 8:10
    
You'll need to install a desktop environment if you don't already have it, or at least X. I'm not familiar with Gentoo so I can't really help further but it certainly comes with a package manager that you can use to install KDE or Gnome or whatever DE. –  romainl Mar 26 '13 at 8:25
    
OK! I am installing the gnome now. Thanks for your help! –  Chen OT Mar 26 '13 at 8:35

It appears that you're running directly in the Linux console. That one runs in a direct (VGA) video mode, and usually supports only 8 colors.

Hard-coding TERM does not help here, and is generally not recommended; the value should be provided by your terminal emulator (should you decide to use one). With the correct value for the Linux console, tput also has a different result:

$ TERM=linux tput colors
8
share|improve this answer
    
thx for your explanation. And is it possible to run another console with 256 color support without X environment on Linux?? –  Chen OT Mar 26 '13 at 9:13
    
Though theoretically possible in certain video modes, I'm not aware that such a high-color console exists. Use X and a terminal emulator like xterm. –  Ingo Karkat Mar 26 '13 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.