Why am I seeing only 8 colors in terminal (Xterm)?

5,450

Take a look at this answer: https://askubuntu.com/questions/147462#153493
You should modify your /.bashrc and add colors description there.

# Format: set color escape sequence \e]P, color number in hex, RGB color in hex
if [ "$TERM" = "linux" ]; then
    echo -en "\e]P02e3436" #black
    echo -en "\e]P1cc0000" #darkred
    echo -en "\e]P24e9a06" #darkgreen
    echo -en "\e]P3c4a000" #brown
    echo -en "\e]P43465a4" #darkblue
    echo -en "\e]P575507b" #darkmagenta
    echo -en "\e]P606989a" #darkcyan
    echo -en "\e]P7d3d7cf" #lightgrey
    echo -en "\e]P8555753" #darkgrey
    echo -en "\e]P9ef2929" #red
    echo -en "\e]PA8ae234" #green
    echo -en "\e]PBfce94f" #yellow
    echo -en "\e]PC729fcf" #blue
    echo -en "\e]PDad7fa8" #magenta
    echo -en "\e]PE34e2e2" #cyan
    echo -en "\e]PFeeeeec" #white
    clear # Fills terminal with base color
fi

I modified the colours to comply with Ubuntu color scheme. Bear in mind that this code is intended for standard Ubuntu installation. In your case you should change condition to [ "$TERM" = "xterm" ], as you use Xubuntu.

Share:
5,450

Related videos on Youtube

Martin Jansen
Author by

Martin Jansen

Updated on September 18, 2022

Comments

  • Martin Jansen
    Martin Jansen over 1 year

    I'm running Xubuntu 13.04 and I want to use Vim as my default editor for everything. I have downloaded many vim color schemas and tried them out, but all of them don't look like the official screenshot.

    For example, vim's own color schema - desert should look like this:

    Should look like this

    But in my vim, many colors won't display, for example the background.

    enter image description here

    So this means a fighting with xfce's Terminal and I can't force it to use 256 colors. the command tput colors gives me 8.

    At the same time the code

    for ((x=0; x<=255; x++));do 
    echo -e "${x}:\033[48;5;${x}mcolor\033[000m"
    done 
    

    shows me nice colors. It seems I missed something. If I run

    echo $TERM
    

    I get xterm. It should be 'xterm-256color'

    When I try

    set term=xterm-256color
    

    and

    export TERM=xterm-256color
    

    Then: echo $TERM

    I get the message

    xterm-256color
    

    But after signout/signin, I'm still not getting the right colors in Vim. And I see the $TERM is changed to xterm again.

    I added:

    if $TERM == "xterm-256color" set t_Co=256 endif
    

    and

    t_Co=256
    

    to my .vimrc file and it didn't seem to help. Then I customized the xterm entries; added this to ~/.Xdefaults:

     *customization: -color
     XTerm*termName: xterm-256color
    Add this to ~/.xsession to apply to new terminals:
    
    if [ -f $HOME/.Xdefaults ]; then
       xrdb -merge $HOME/.Xdefaults
    fi
    

    When I changed in preferences of terminal, emulate terminal environment, the xterm to xterm-256color

    I get the message:

     '*** VTE ***: Failed to load terminal capabilities from '/etc/termcap' 
    

    When I check /usr/share/vte/termcap/xterm, the file xterm-256color is missing. Same in the folder xterm0.0. I tried to find this file on the internet to download and put in the folder, but I couldn't find it.

    This is driving me crazy the whole day... Does anyone have suggestions?