You are not logged in.

#1 2010-06-21 17:26:08

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

[Solved] [URxvt] find the right color...

Hi,
I've got a pretty stupid question here but I really can't find the solution myself. lol

[Short Version]
How do I convert an HTML color code (#101010) to a color index for rxvt-unicode (88 colors)?

[Long Version]
I'm using the standard rxvt-unicode (88 colors) and I'm trying out urxvt's tabbed perl extension.
I also found that it is possible to change tabs colors by specifing the following in .Xdefaults:

URxvt.tabbed.tabbar-fg: <colour-index, default 3>
URxvt.tabbed.tabbar-bg: <colour-index, default 0>
URxvt.tabbed.tab-fg:    <colour-index, default 0>
URxvt.tabbed.tab-bg:    <colour-index, default 1>

Unlike other .Xdefaults entries I cannot specify HTML color codes (#101010) but only color indexes that are basically my 16 .Xdefaults' colors plus (according to urxvt's man page):

In addition to the colours defined above, urxvt offers an additional 72 colours. The first 64 of those (with indices 16 to 79) consist of a 4*4*4 RGB colour cube (i.e. index = r * 16 + g * 4 + b + 16), followed by 8 additional shades of gray (with indices 80 to 87).

Basically, I just would like to use my URxvt.background color (#101010) for the tabs' background but I don't know how to find it between urxvt's 88 colors.

Yes, it should be rather simple, can someone please help me?
Thank you! big_smile

Last edited by rent0n (2010-06-21 19:32:42)


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#2 2010-06-21 18:18:47

SiC
Member
From: Liverpool, England
Registered: 2008-01-10
Posts: 430

Re: [Solved] [URxvt] find the right color...

Hmmm... Weeell, in urxvt, you can use RGB colouring, so  you can use #000000 for black and #FFFFFF for white and so forth.  My xdefaults for urxvt are as follows:

urxvt.cursorColor: green
urxvt.depth: 32
urxvt.scrollBar_right: True
urxvt.foreground: #B2B2B2
urxvt.background: rgba:0000/0000/0000/dddd
urxvt.Transparent: True
urxvt.tintColor: blue
urxvt.shading: 40
urxvt.fading: 60
urxvt.color0: #000000
urxvt.color1: #B21818
urxvt.color2: #18B218
urxvt.color3: #B26818
urxvt.color4: #1818B2
urxvt.color5: #B218B2
urxvt.color6: #18B2B2
urxvt.color7: #B2B2B2
urxvt.colorBD: #FFFFFF
urxvt.color8: #686868
urxvt.color9: #FF5454
urxvt.color10: #54FF54
urxvt.color11: #FFFF54

I have quite a simple config, and don't use tabs, but the principle is sound

Last edited by SiC (2010-06-21 18:19:30)

Offline

#3 2010-06-21 19:09:15

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Solved] [URxvt] find the right color...

Thanks for your reply.

I probably wasn't clear enough but the problem actually is that I can't specify colors in the HTML/Hex code (like #000000) for the URxvt.tabbed entries and I need to use urxvt color indexes.

Anyone?


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#4 2010-06-21 19:21:04

droog
Member
Registered: 2004-11-18
Posts: 877

Re: [Solved] [URxvt] find the right color...

I think your custom xdefault colors should be the first 15 colors. a script like this one http://zhar.net/projects/shell/terminal_colors will show it.
run it with -n to show the numbers.
0 should be your background color.

edit:
I think -1 is the background color. 0 is one of the blacks.

Last edited by droog (2010-06-21 19:22:58)

Offline

#5 2010-06-21 19:24:29

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: [Solved] [URxvt] find the right color...

It's not a complete answer, but you can figure out what each numbered color really is by doing:

echo -e '\e]4;COLORNUMBER;?\a'

where COLORNUMBER is between 0 and 87. For instance, " echo -e '\e]4;29;?\a' " returns " 4;rgb:0000/ffff/8b8b ", so "color30" is #00ff8b.

Offline

#6 2010-06-21 19:32:23

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 457
Website

Re: [Solved] [URxvt] find the right color...

droog wrote:

I think your custom xdefault colors should be the first 15 colors. a script like this one http://zhar.net/projects/shell/terminal_colors will show it.
run it with -n to show the numbers.
0 should be your background color.

edit:
I think -1 is the background color. 0 is one of the blacks.

YAY!!
-1 is the background color and -2 is the foreground! So simple!
Great, thank you very much! big_smile

@ataraxia: that's interesting too, thank you!


rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686

Offline

#7 2012-12-02 00:13:36

Leandros
Member
Registered: 2012-12-01
Posts: 25

Re: [Solved] [URxvt] find the right color...

The solution with the "terminal_colors" script worked.

For everyone with the same problem, here is a reupload of the script: https://docs.google.com/open?id=0B594FZ … HFqNEZyMWc

Offline

Board footer

Powered by FluxBB