LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-06-2016, 03:38 PM   #1
NeoTheFox
LQ Newbie
 
Registered: Jan 2016
Distribution: Arch Linux
Posts: 9

Rep: Reputation: Disabled
urxvt and 256 colors issue


I cant get urxvt to work with colors. I am using this script to see the colors:
Code:
awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'
In urxvt I am getting: https://imgur.com/OpQIKSd
But if I launch tmux, and then do it: https://imgur.com/8DOyCC3

Any ideas what is wrong here? My Xresources: http://cxg.de/_53896c.htm
 
Old 10-07-2016, 08:46 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 5,762

Rep: Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279
This is going to be horribly technical.
tl;dr
The test script you are using includes ANSI escape codes that urxvt does not recognise. For an alternative.

For the nitty-gritty:
The setting of foreground and background colours can be done using
Quote:
Xterm,[14] KDE's Konsole,[18] as well as all libvte based terminals[19] (including GNOME Terminal) support ISO-8613-3 24-bit foreground and background color setting[better source needed] Quoting one of the text-files in its source-tree:[20][better source needed]

ESC[ 38;2;<r>;<g>;<b> m Select RGB foreground color
ESC[ 48;2;<r>;<g>;<b> m Select RGB background color

In 256-color mode (ESC[38;5;<fgcode>m and ESC[48;5;<bgcode>m), the color-codes are the following:[citation needed]

0x00-0x07: standard colors (as in ESC [ 3037 m)
0x08-0x0F: high intensity colors (as in ESC [ 9097 m)
0x10-0xE7: 6 6 6 = 216 colors: 16 + 36 r + 6 g + b (0 ≤ r, g, b ≤ 5)
0xE8-0xFF: grayscale from black to white in 24 steps
The test script uses the ISO-8613-3 24-bit foreground and background color setting ANSI codes, while the alternative suggestion uses the ESC[38;5;<fgcode>m and ESC[48;5;<bgcode>m ANSI codes.

If you run 'infocmp' in urxvt you will see this in the output
Quote:
setb=%?%p1%{7}%>%t\E[48;5;%p1%dm%e\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;,
setf=%?%p1%{7}%>%t\E[38;5;%p1%dm%e\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;,
So urxvt uses the ESC[38;5;<fgcode>m and ESC[48;5;<bgcode>m ANSI codes.

Following the link from reference 19 in the Wikipedia page, you can get to this, a lambast of low quality coding.
 
Old 10-07-2016, 11:21 AM   #3
NeoTheFox
LQ Newbie
 
Registered: Jan 2016
Distribution: Arch Linux
Posts: 9

Original Poster
Rep: Reputation: Disabled
Ah, thanks, so the problem is on NeoVim's side of the equasion, and thats why tmux works fine
 
Old 10-07-2016, 01:39 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,995
Blog Entries: 12

Rep: Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456Reputation: 5456
how did neovim get into it all of a sudden?

fwiw, i'm seeing the exact same problem with the awk script & urxvt.
i don't use neovim.
 
Old 10-07-2016, 02:18 PM   #5
NeoTheFox
LQ Newbie
 
Registered: Jan 2016
Distribution: Arch Linux
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
how did neovim get into it all of a sudden?

fwiw, i'm seeing the exact same problem with the awk script & urxvt.
i don't use neovim.
Oh yeah, I did bot mentioned why I've ran into this problem in a first place. I've been trying to get NeoSolarized to run, but it just messes colors up, and I found out that it worked flawlessly in uxterm.
 
  


Reply

Tags
colors, terminal, urxvt


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Start tmux on Login - with 256 colors Jean-Luc Besson Linux - Newbie 1 02-05-2013 11:54 PM
must be configured to display at least 256 colors arun_sam Linux - Newbie 1 07-19-2012 05:34 AM
How to configure Xterm colors if my xterm can support 256 colors n179911 Linux - Software 4 07-06-2009 02:28 AM
Only 256 colors on Slackware 9.1 Quartzophobia Linux - Laptop and Netbook 1 01-27-2004 04:26 PM
New display won't work above 256 colors wghoward Linux - Software 3 08-05-2003 08:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration