You are not logged in.

#1 2007-03-21 19:14:59

stb
Member
Registered: 2007-03-13
Posts: 40

[SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

I started to use screen and I'm having some problems with shuffled colors. I think a screenshot is best to describe the problem:

07032120115475.direkt.jpg

What can I do else besides setting the hopefully correct term and terminfo in .screenrc?

Thanks

Dennis

EDIT: I did not look properly. They're not shuffled, they're completely wrong.

Solution: Set terminal type to rxvt-256color (must be under /usr/share/terminfo).

Last edited by stb (2007-03-22 12:54:50)

Offline

#2 2007-03-22 00:24:32

veek
Member
Registered: 2006-03-10
Posts: 167

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

I also use screen with urxvt, and I'm fairly certain my colors display correctly.
If you post that showcolors script, I can verify.

As far as terminfo I think screen recognizes rxvt, but not urxvt so try adding this to your ~/.Xdefaults:

URxvt*termName: rxvt

That should cause urxvt to report itself as rxvt when terminfo is requested.
If you do try that, make sure you open a new terminal to see whether it has any effect.
I know I added that to my .Xdefaults a while ago, and I think it addressed some issue in screen, but I can't remember what it was.

Last edited by veek (2007-03-22 00:26:30)

Offline

#3 2007-03-22 00:52:51

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

The problem is your screen terminfo doesn't support 88 colors.  It supports 16.  Try setting:

term screen-256color

in your screenrc.  There is no screen-88color, but screen tends to Do The Right Thing with color numberings

Offline

#4 2007-03-22 01:07:45

stb
Member
Registered: 2007-03-13
Posts: 40

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

URxvt*termName: rxvt

This restricted my urxvt to 16 colors :-).

I hacked screen a bit and found a function named color256to88():

#ifdef COLORS256
int
color256to88(jj)
int jj;
{
  int r, g, b;

  if (jj >= 232)
    return (jj - 232) / 3 + 80;
  if (jj >= 16)
    { 
      return jj;
      /*
      jj -= 16;
      r = jj / 36;
      g = (jj / 6) % 6;
      b = jj % 6;
      return ((r + 1) / 2) * 16 + ((g + 1) / 2) * 4 + ((b + 1) / 2) + 16;
      */
    }
  return jj;
}
#endif

The purpose of this function is to remap the color codes from 6x6x6 color cube (256 colors) to 4x4x4 color cube (88 colors). That is, when you set the term to 'screen-256color' in .screenrc it is possible to use color codes from 0 .. 255. The drawback is they get mapped to 0 .. 88, so you gain nothing but have to rewrite all of your color configurations.

I edited the function not to remap the codes as you can see. Now it works as I want but can this feature be enabled without editing the source? It would be very interesting for me to know if you use only colors less than 88 or do you use the whole range up to 255?

Offline

#5 2007-03-22 07:30:21

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

I just use 256 colours, vim, screen, xterm, urxvt and even rxvt support it.

What advantage is there to use 88 instead of 256?

James

Offline

#6 2007-03-22 10:41:16

stb
Member
Registered: 2007-03-13
Posts: 40

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

What advantage is there to use 88 instead of 256?

None. But how do I setup 256 color mode in urxvt itself, so that I can use the same colorings both under screen and urxvt?

Offline

#7 2007-03-22 12:22:11

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

I thought urxvt had 256 colour mode, but googling tells me otherwise. I use xterm myself, as I had font isues in urxvt, so I can't say for sure.

You could try URxvt*termName: rxvt-256color, see how that goes, along with the screen config option that was mentioned above by phrak.

James

Offline

#8 2007-03-22 12:53:26

stb
Member
Registered: 2007-03-13
Posts: 40

Re: [SOLVED]: screen + urxvt: Shuffled(?) colors (16-88)

My hero! That did it! Now screen displays the colors "correct". And again, I learned something about the terminfo stuff. Is it right to say that you did a find /usr/share/terminfo/| grep 256 to find this terminal type?

Offline

Board footer

Powered by FluxBB