View previous topic :: View next topic |
Author |
Message |
fhaddad78 n00b
Joined: 21 May 2012 Posts: 68
|
Posted: Fri Aug 31, 2012 8:15 pm Post subject: Is it possible to enable 256 or more colors in the console? |
|
|
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 |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Fri Aug 31, 2012 8:59 pm Post subject: |
|
|
You can check how Fedora do it - they add /etc/DIR_COLORS* via coreutils. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Sep 01, 2012 12:29 am Post subject: |
|
|
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 |
|
|
aCOSwt Bodhisattva
Joined: 19 Oct 2007 Posts: 2537 Location: Hilbert space
|
Posted: Sat Sep 01, 2012 8:47 am Post subject: |
|
|
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 in order to see which modes are made available by your graphic device. _________________
|
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sat Sep 01, 2012 12:36 pm Post subject: Re: Is it possible to enable 256 or more colors in the conso |
|
|
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 |
|
|
fhaddad78 n00b
Joined: 21 May 2012 Posts: 68
|
Posted: Sat Sep 01, 2012 2:04 pm Post subject: |
|
|
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 |
|
|
|