GNU Screen: 256 colors not enabled

Bug #87966 reported by Paulo Tanimoto
40
This bug affects 2 people
Affects Status Importance Assigned to Milestone
screen (Ubuntu)
Fix Released
Wishlist
Martin Pitt

Bug Description

Binary package hint: screen

I was playing with Vim's 256 color capabilities and I found out that they won't work in (GNU) screen. That's very sad, because I run most things on top of screen.

Some googling pointed me to a few directions:
http://frexx.de/xterm-256-notes/
http://www.jukie.net/~bart/blog/20060824224842

I followed the suggestions in the latter link and compiled screen myself with:
--enable-colors256

In fact it's just a matter of uncommenting a line in ./debian/rules

I wonder if we can update screen to come with this option by default, since xterm already uses it.

Thanks.

PS: By the way, if you like Vim, check inkpot. It's a sweet color scheme. You'll probably understand why I'm making this request. : )

Changed in screen:
assignee: nobody → pitti
Revision history for this message
Martin Pitt (pitti) wrote :

Not sure why I got this assigned, but *shrug* why not.

Changed in screen:
importance: Undecided → Wishlist
status: Unconfirmed → In Progress
Revision history for this message
Paulo Tanimoto (tanimoto) wrote :

Thank you Matt.

To minimize your amount of work, here's all that should be needed to change in debian/rules:
Line 30: add \ to the end of the line
Line 31: uncomment

Sorry I'm not proficient with diff.

incubus

Revision history for this message
Evan Klitzke (eklitzke2) wrote :

I just compiled screen with 256 color support, and now I am one happy camper. Gnome-terminal, xterm, and quite a few others all have 256 color support now, so it makes sense to compile screen with support for 256 colors.

To actually use 256 colors you need to make some changes to your screenrc, so I don't see how turning this on could possibly hurt (since it isn't enabled by default). Please turn on support for this in Edgy.

Revision history for this message
Paulo Tanimoto (tanimoto) wrote :

Good point, Evan.

Correct if I'm mistaken, but here's what we need in .screenrc (for people who don't want to read those links):
<---------cut here--------->
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"
<---------cut here--------->

Using xterm with 256 colors reminded me of going from ega to vga. Boy, I'm getting old...

incubus

Revision history for this message
Diwaker Gupta (diwaker) wrote :

Is there an update on the status of this bug? I'd like to see 256 color support by default as well.

Revision history for this message
Nathan Howell (neh) wrote :

I'd like to see this fixed as well. It's easy enough to rebuild the packages for myself, but it doesn't make a lot of sense that I have to. So here's a patch for the feisty version (I'm not running gutsy yet). I'm not sure whether that's useful, but there it is.

Revision history for this message
Martin Pitt (pitti) wrote :

screen (4.0.3-0.4ubuntu2) gutsy; urgency=low

  * debian/rules: Enable 256 color support. (LP: #87966)

 -- Martin Pitt <email address hidden> Thu, 26 Jul 2007 16:39:36 +0200

Changed in screen:
status: In Progress → Fix Released
Revision history for this message
userundefine (p00ldy) wrote :

That patched helped me, Nathan, thanks. Much easier than upgrading to gutsy.

Revision history for this message
eastersunshine (eastersunshine-deactivatedaccount) wrote :

Hi,

Can the relevant lines to enable 256 colors be added to /etc/screenrc by default? At least commented? In Hardy, I didn't have 256 color support out-of-the-box nor were the lines in /etc/screenrc and had to Google for it. I'm not sure if I'm missing something, but is there any reason for it to NOT be enabled by default?

Revision history for this message
Martin Pitt (pitti) wrote :

I just tried this in current intrepid, and 256 colors worked out of the box in screen. I used http://www.vim.org/scripts/script.php?script_id=1349 for testing.

Revision history for this message
holst (henrik-holst-matmech) wrote :

I have Ubuntu Intrepid and it does NOT work for me! :-(

na56:~>apt-cache show screen
Package: screen
Priority: optional
Section: misc
Installed-Size: 1008
Maintainer: Ubuntu Core Developers <email address hidden>
Original-Maintainer: Jan Christoph Nordholz <email address hidden>
Architecture: i386
Version: 4.0.3-11
Depends: libc6 (>= 2.4), libncursesw5 (>= 5.6+20071006-3), libpam0g (>= 0.99.7.1)
Filename: pool/main/s/screen/screen_4.0.3-11_i386.deb
Size: 604260
MD5sum: c417ff02d7bb57b9873eafe441a5686c
SHA1: b901386c72a12006efd4752f1b16b7ef5fb2ac51
SHA256: 21159872fc1ae83373afb7b77a7b18538c4e359556e427d31d0902e31a8889f1

A screenshot of the colortest program running in gnome-terminal:

http://img120.imageshack.us/my.php?image=screenshotholstna561df3.png

and here in a screen:

http://img296.imageshack.us/my.php?image=screenwz6.png

/holst

Revision history for this message
Martin Pitt (pitti) wrote :

Hm, confirmed, but it's enabled during build, and config.h has COLORS256=1. So this is either a problem of how to invoke screen, or an upstream regression.

Revision history for this message
Matt Wheeler (funkyhat) wrote :

I'm having this problem with Intrepid too, should the bug be reopened for Intrepid?

Revision history for this message
Anonym25712 (anonym25712) wrote :

Same problem here on Intrepid.

Revision history for this message
disappearedng (disappearedng) wrote :

Hey I just upgraded to 9.04 and I can confirm that the bug is still here.

First, screen does come built in with 256 color support,
[code]
      --enable-pam \
      --with-pty-mode=0620 \
      --with-pty-group=${TTYGROUP} \
      --enable-rxvt_osc \
      --with-sys-screenrc=/etc/screenrc \
      --enable-colors256
 # Assert the use of fifos instead of sockets
 grep -q "define.*NAMEDPIPE.*1" config.h || echo "#define NAMEDPIPE 1" >> config.h
 touch $@
[/code]

I followed the instruction from http://www.jukie.net/~bart/blog/20060824224842.

Turns out that there is still no support for 256 colors in screen..

Note that I have added
<---------cut here--------->
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"
<---------cut here--------->

into my screenrc

I am on 9.04

Revision history for this message
Les Harris (lesharris) wrote :

The only 'bug' is that the screenrc doesn't enable the 256 colors by default.

<---------cut here--------->
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"
<---------cut here--------->

That gets you 95% of the way there, after that you just need to set the terminal type in screenrc, ie adding:

term xterm

completes the configuration.

Revision history for this message
disappearedng (disappearedng) wrote :

@ Les Harris:

Adding "term xterm" at the end of my .screenrc together with the section provided (<--cut here-->.*<-- cut here-->) does not have any effect.

Revision history for this message
Jason Cohen (kryojenik) wrote :

The TERM variable in screen it TERM=screen or TERM=screen-bce. If you are doing the defbce as above screen is smart enough to set the TERM to screen-bce. However, the screen and screen-bce terminfos are 8 Color terminals. So when you run ncurses apps they will look at the terminfo capabilites and see you are an 8 color terminal.

You can set term screen-256color-bce in your screenrc to set this correctly (at least in karmic). That terminfo exists and is a 256 color terminal (as is screen-256color).

Or you can set in the command line to screen.

screen -T screen-256color. Again, if you hace defbce set in screenrc screen will add the -bce to the term for you.

Ultimately it would be nice for screen itself to check if the term supports 256 colors and then set an appropriate TERM based on that.

or if in a script, you can check you hosting terms capabilities...

[ -x /usr/bin/tput ] && [ $(/usr/bin/tput colors) -eq 256 ] && SCREEN_TERM="-T screen-256color"
screen $SCREEN_TERM

When connecting from putty or SecureCRT send xterm-256color to get a host terminfo that supports 256 colors.

Revision history for this message
dj3 (dim-jakobi) wrote :

My terminal can display 256 colors by default:

:~$ tput colors
256

In order to get vim in gnome-terminal to display colorschemes the same way as the GUI version I used the plugin CSApprox:

http://www.vim.org/scripts/script.php?script_id=2390

On how to use it and some further discussion on the topic of using 256 colors in vim cf this useful article:

http://vim.wikia.com/wiki/Using_GUI_color_settings_in_a_terminal

Revision history for this message
disappearedng (disappearedng) wrote : Re: [Bug 87966] Re: GNU Screen: 256 colors not enabled

On Mon, Feb 15, 2010 at 2:51 AM, dj3 <email address hidden> wrote:

> My terminal can display 256 colors by default:
>
> :~$ tput colors
> 256
>
1) tput colors of my computer results in 8

>
> In order to get vim in gnome-terminal to display colorschemes the same
> way as the GUI version I used the plugin CSApprox:
>
> http://www.vim.org/scripts/script.php?script_id=2390
>
> On how to use it and some further discussion on the topic of using 256
> colors in vim cf this useful article:
>
> http://vim.wikia.com/wiki/Using_GUI_color_settings_in_a_terminal
>
> I followed the guide and installed CSApprox and I tried forcing t_Co=256
and forcing it to t_Co=8 but there is still no changes.

> --
> GNU Screen: 256 colors not enabled
> https://bugs.launchpad.net/bugs/87966
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “screen” package in Ubuntu: Fix Released
>
> Bug description:
> Binary package hint: screen
>
> I was playing with Vim's 256 color capabilities and I found out that they
> won't work in (GNU) screen. That's very sad, because I run most things on
> top of screen.
>
> Some googling pointed me to a few directions:
> http://frexx.de/xterm-256-notes/
> http://www.jukie.net/~bart/blog/20060824224842<http://www.jukie.net/%7Ebart/blog/20060824224842>
>
> I followed the suggestions in the latter link and compiled screen myself
> with:
> --enable-colors256
>
> In fact it's just a matter of uncommenting a line in ./debian/rules
>
> I wonder if we can update screen to come with this option by default, since
> xterm already uses it.
>
> Thanks.
>
> PS: By the way, if you like Vim, check inkpot. It's a sweet color scheme.
> You'll probably understand why I'm making this request. : )
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/screen/+bug/87966/+subscribe
>

Revision history for this message
dj3 (dim-jakobi) wrote :

In Ubuntu 256 colors are not enabled by default, sorry. Here is how I did it: install the "ncurses-term" package and than put the line "export TERM=xterm-256color" in your .bashrc file. Log out, log in. Now you should get in any terminal (gnome, xterm):

~$ tput colors
256

I don't see any bugs.

Revision history for this message
disappearedng (disappearedng) wrote :

dj3 thanks a lot.
That worked out real nice.

On Tue, Feb 16, 2010 at 1:55 AM, dj3 <email address hidden> wrote:

> In Ubuntu 256 colors are not enabled by default, sorry. Here is how I
> did it: install the "ncurses-term" package and than put the line "export
> TERM=xterm-256color" in your .bashrc file. Log out, log in. Now you
> should get in any terminal (gnome, xterm):
>
> ~$ tput colors
> 256
>
> I don't see any bugs.
>
> --
> GNU Screen: 256 colors not enabled
> https://bugs.launchpad.net/bugs/87966
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “screen” package in Ubuntu: Fix Released
>
> Bug description:
> Binary package hint: screen
>
> I was playing with Vim's 256 color capabilities and I found out that they
> won't work in (GNU) screen. That's very sad, because I run most things on
> top of screen.
>
> Some googling pointed me to a few directions:
> http://frexx.de/xterm-256-notes/
> http://www.jukie.net/~bart/blog/20060824224842<http://www.jukie.net/%7Ebart/blog/20060824224842>
>
> I followed the suggestions in the latter link and compiled screen myself
> with:
> --enable-colors256
>
> In fact it's just a matter of uncommenting a line in ./debian/rules
>
> I wonder if we can update screen to come with this option by default, since
> xterm already uses it.
>
> Thanks.
>
> PS: By the way, if you like Vim, check inkpot. It's a sweet color scheme.
> You'll probably understand why I'm making this request. : )
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/screen/+bug/87966/+subscribe
>

Revision history for this message
Mihai Capotă (mihaic) wrote :

dj3, this bug is about screen.

Jason Cohen is right in comment 18: it's not enough that the terminal supports 256 colors, it should also advertise it.

Byobu does it by default after fixing bug 409353:
mihai@dutier:~$ tput colors
256

Screen should also do it. Please consider reopening this bug (I don't have the permission to reopen it myself).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.