Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is it possible to enable 256 or more colors in the console?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
fhaddad78
n00b
n00b


Joined: 21 May 2012
Posts: 68

PostPosted: Fri Aug 31, 2012 8:15 pm    Post subject: Is it possible to enable 256 or more colors in the console? Reply with quote

I have tried searching the net for 256 color console mode and it seems that the results are for a 256 color xterm which is not what I am looking for. From X, I can open an xterm session and 256 color works.

Here is my setup. I do not boot directly into X. I boot and login to my system from the console. I would like to use Vim and do programming (for my school assignments) at the console without starting X. Call me weird, but I prefer it. Anyway, I can do that, but I can not get 256 color support. I've tried adding to ~/.vimrc changes like t_Co=256, etc, but that doesn't seem to work.

I am using the nouveau driver and my kernel line in grub.conf has video=DVI-I-1:1024x768@60

Any guidance or direction on how to do this would be great. The reason I want 256 or more colors is so I can use my console supported 256 color themes for Vim.

Thanks!

UPDATE:

Just wanted to share I tried adding to my ~/.bashrc file export TERM="xterm-256color", but that seemed to cause undesirable results. As an example, when I would emerge a package, the results of each package would not appear on the line below..

Example:

>>> 1 of 3 ....
>>> 2 of 3 ....

instead I was getting...

>>> 1 of 3 .... >>> 2 of
3 ...

Weird stuff like that.


Last edited by fhaddad78 on Fri Aug 31, 2012 9:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Aug 31, 2012 8:59 pm    Post subject: Reply with quote

You can check how Fedora do it - they add /etc/DIR_COLORS* via coreutils.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Sep 01, 2012 12:29 am    Post subject: Reply with quote

You have no choice but to use a terminal emulator that supports 256 colours on the framebuffer console, like terminology or kmscon.
Back to top
View user's profile Send private message
aCOSwt
Bodhisattva
Bodhisattva


Joined: 19 Oct 2007
Posts: 2537
Location: Hilbert space

PostPosted: Sat Sep 01, 2012 8:47 am    Post subject: Reply with quote

I suggest you read : /usr/src/linux/Documentation/fb/vesafb.txt and see if it helps.

I personally use lilo & vesa. (I do not know grub but I think you can adapt).

In my lilo.conf, I set :
Code:
vga=0x37b
append="video=vesafb:mtrr:3,ywrap"


Of course, depending on your card, some modes might not be available and non standard ones made available.
So I suggest that you first boot with
Code:
vga=ask
in order to see which modes are made available by your graphic device.
_________________
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Sep 01, 2012 12:36 pm    Post subject: Re: Is it possible to enable 256 or more colors in the conso Reply with quote

fhaddad78 wrote:
[...] I've tried adding to ~/.vimrc changes like t_Co=256, etc, but that doesn't seem to work.

fhaddad78 ...

vim can only use t_Co=256 if the terminfo supports this, and the terminfo 'console' (or terminfo 'linux') doesn't. For example I have in my .vimrc

Code:
if &t_Co > 2
    syntax on
    set notimeout
    set ttimeout
    set timeoutlen=100
endif

if &term == "linux"
    imap <C-?> <C-h>
endif

and further on ...
Code:
if &t_Co > 8
    let g:solarized_termcolors=16
    set background=dark
    colorscheme solarized
endif

So, t_Co doesn't set the terminfo but changes the behavior dependent on what information is provided by terminfo.

Similarly in my shell (.zshrc) ..

Code:
if (( $+commands[dircolors] )) && (( $terminfo[colors] == 256 )) ; then
    if [[ -f ${HOME}/.dir_colors ]]; then
        eval $(dircolors -b ${HOME}/.dir_colors)
    else
        eval $(dircolors -b)
    fi
fi

The terminfo for 'linux' (or 'console') provides 8 colours, regardless of the framebuffer. There is however a terminfo for 'linux-16color', which can be set via 'export TERM='linux-16color' and generally will work, but 256 colours requires a terminal application (that supports 256 colours) running in X11.

fhaddad78 wrote:
Just wanted to share I tried adding to my ~/.bashrc file export TERM="xterm-256color", but that seemed to cause undesirable results. As an example, when I would emerge a package, the results of each package would not appear on the line below..

Terminfo provides more than just colour infomation so setting the console to TERM=xterm-256color can have unexpected results.

best ... khay
Back to top
View user's profile Send private message
fhaddad78
n00b
n00b


Joined: 21 May 2012
Posts: 68

PostPosted: Sat Sep 01, 2012 2:04 pm    Post subject: Reply with quote

thanks for all the info everyone.

@khayyam I especially like your VIM ideas to distinguish and configure itself differently based on the result of t_Co.. I will work with that to configure vim for console and X terminal modes.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum