LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-09-2019, 05:57 PM   #1
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
xterm 256 colours after migration to terminfo in -current


I'm sorry to bother you all with this again. I can't find my terminal setup notes, and I've been fairly religious about keeping notes for years now. Although I'm not even sure I ever solved this particular issue.

What is the correct way to set xterm-256color, now that Slackware has moved from termcap to terminfo? I used to add xterm-256color to /etc/termcap.

Even adding XTerm*termName:xterm-256color to ~/.Xresources doesn't work: tput colors still gives me only 8. And echo $TERM reports xterm, not even xterm-new.
 
Old 09-10-2019, 07:01 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,658

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
And have you tried investigating the available values and setting TERM yourself to see if that is all it takes to provide the bahvior you seek?
 
Old 09-10-2019, 08:15 AM   #3
deNiro
Member
 
Registered: Jun 2003
Distribution: Slackware-Current and Salix 14.2
Posts: 274
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by Gerard Lally View Post
I'm sorry to bother you all with this again. I can't find my terminal setup notes, and I've been fairly religious about keeping notes for years now. Although I'm not even sure I ever solved this particular issue.

What is the correct way to set xterm-256color, now that Slackware has moved from termcap to terminfo? I used to add xterm-256color to /etc/termcap.

Even adding XTerm*termName:xterm-256color to ~/.Xresources doesn't work: tput colors still gives me only 8. And echo $TERM reports xterm, not even xterm-new.
xterm*termName: xterm-256color

(so instead Xterm in beginning, type, xterm). does that work? because i think i once fixed it like that.
 
Old 09-10-2019, 08:37 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
termcap/terminfo should have no bearing. The following in .Xresources should be all you need.
XTerm.termName: xterm-256color
 
1 members found this post helpful.
Old 09-10-2019, 09:18 AM   #5
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Original Poster
Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by wpeckham View Post
And have you tried investigating the available values and setting TERM yourself to see if that is all it takes to provide the bahvior you seek?
Setting $TERM works, but I'd rather do it the correct way. Hard-coding the terminal doesn't sound right to me.
 
Old 09-10-2019, 09:20 AM   #6
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Original Poster
Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by GazL View Post
termcap/terminfo should have no bearing. The following in .Xresources should be all you need.
XTerm.termName: xterm-256color
I'll try it with XTerm.termName instead of XTerm*termName when I get home again.
 
Old 09-10-2019, 09:20 AM   #7
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Original Poster
Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by deNiro View Post
xterm*termName: xterm-256color

(so instead Xterm in beginning, type, xterm). does that work? because i think i once fixed it like that.
I'll give that a go. Thanks.
 
Old 09-10-2019, 09:33 AM   #8
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,374

Rep: Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754
Quote:
XTerm.termName: xterm-256color
Yep - That works here.
A couple of test scripts pinched from here
Code:
#!/bin/bash
# Based on: https://gist.github.com/XVilka/8346728

awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
    s="/\\";
    for (colnum = 0; colnum<term_cols; colnum++) {
        r = 255-(colnum*255/term_cols);
        g = (colnum*510/term_cols);
        b = (colnum*255/term_cols);
        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%2+1,1);
    }
    printf "\n";
}'
and
Code:
#!/bin/bash                                                                                                                                                                                     
# This file was originally taken from iterm2 https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh                                                                               
#                                                                                                                                                                                           
#   This file echoes a bunch of 24-bit color codes                                                                                                                                              
#   to the terminal to demonstrate its functionality.                                                                                                                                           
#   The foreground escape sequence is ^[38;2;<r>;<g>;<b>m                                                                                                                                       
#   The background escape sequence is ^[48;2;<r>;<g>;<b>m                                                                                                                                       
#   <r> <g> <b> range from 0 to 255 inclusive.                                                                                                                                                  
#   The escape sequence ^[0m returns output to default                                                                                                                                          

setBackgroundColor()                                                                                                                                                                            
{                                                                                                                                                                                           
    #printf '\x1bPtmux;\x1b\x1b[48;2;%s;%s;%sm' $1 $2 $3                                                                                                                                        
    printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3                                                                                                                                                       
}                                                                                                                                                                                           

resetOutput()                                                                                                                                                                                   
{                                                                                                                                                                                           
    echo -en "\x1b[0m\n"                                                                                                                                                                        
}                                                                                                                                                                                           

# Gives a color $1/255 % along HSV                                                                                                                                                              
# Who knows what happens when $1 is outside 0-255                                                                                                                                               
# Echoes "$red $green $blue" where                                                                                                                                                              
# $red $green and $blue are integers                                                                                                                                                            
# ranging between 0 and 255 inclusive                                                                                                                                                           
rainbowColor()                                                                                                                                                                                  
{                                                                                                                                                                                               
    let h=$1/43                                                                                                                                                                                 
    let f=$1-43*$h                                                                                                                                                                              
    let t=$f*255/43                                                                                                                                                                             
    let q=255-t                                                                                                                                                                                 

    if [ $h -eq 0 ]                                                                                                                                                                             
    then                                                                                                                                                                                        
        echo "255 $t 0"                                                                                                                                                                         
    elif [ $h -eq 1 ]                                                                                                                                                                           
    then                                                                                                                                                                                        
        echo "$q 255 0"                                                                                                                                                                         
    elif [ $h -eq 2 ]                                                                                                                                                                           
    then
        echo "0 255 $t"
    elif [ $h -eq 3 ]
    then
        echo "0 $q 255"
    elif [ $h -eq 4 ]
    then
        echo "$t 0 255"
    elif [ $h -eq 5 ]
    then
        echo "255 0 $q"
    else
        # execution should never reach here
        echo "0 0 0"
    fi
}

for i in `seq 0 127`; do
    setBackgroundColor $i 0 0
    echo -en " "
done
resetOutput
for i in `seq 255 -1 128`; do
    setBackgroundColor $i 0 0
    echo -en " "
done
resetOutput

for i in `seq 0 127`; do
    setBackgroundColor 0 $i 0
    echo -n " "
done
resetOutput
for i in `seq 255 -1 128`; do
    setBackgroundColor 0 $i 0
    echo -n " "
done
resetOutput

for i in `seq 0 127`; do
    setBackgroundColor 0 0 $i
    echo -n " "
done
resetOutput
for i in `seq 255 -1 128`; do
    setBackgroundColor 0 0 $i
    echo -n " "
done
resetOutput

for i in `seq 0 127`; do
    setBackgroundColor `rainbowColor $i`
    echo -n " "
done
resetOutput
for i in `seq 255 -1 128`; do
    setBackgroundColor `rainbowColor $i`
    echo -n " "
done
resetOutput
I also have a similar line for urxvt, 'URxvt.termName: rxvt-unicode-256color', but the test scripts fail in urxvt.
Apparently a patch was introduced into urxvt after the last stable release to support 24bit color, but stable releases are infrequent. Perhaps a build of the CVS version of rxvt-unicode could be introduced into /testing in -current?
 
Old 09-10-2019, 09:51 AM   #9
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Original Poster
Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by allend View Post
Yep - That works here.
Can somebody with Eric's Plasma in -current test this as well, please? I remember now having trouble with xterm honouring at least fg and bg colour resources in Plasma 5 in current. Specifically, the bg and fg colours are reversed.

xrdb ~/.Xresources corrects those two colour resources but the terminal remains an 8-colour terminal. In other words, xterm-256color in .Xresources is ignored, while other resources settings are honoured.

Last edited by Gerard Lally; 09-10-2019 at 09:55 AM.
 
Old 09-10-2019, 12:10 PM   #10
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Original Poster
Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Quote:
Originally Posted by GazL View Post
termcap/terminfo should have no bearing. The following in .Xresources should be all you need.
XTerm.termName: xterm-256color
Substituting a stop for an asterisk did indeed solve the problem. Back to man X for me. Thanks, as always.

Last edited by Gerard Lally; 09-10-2019 at 12:27 PM.
 
Old 09-10-2019, 12:12 PM   #11
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,181

Original Poster
Rep: Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763Reputation: 1763
Thanks, people. Simple solution: XTerm.termName works, XTerm*termName doesn't.
 
  


Reply



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] xterm doesn't support 256 colors because linked against termcap, not terminfo IlyaK Slackware 4 04-03-2019 08:07 PM
[SOLVED] mlterm uses xterm terminfo/termcap Gerard Lally Slackware 6 03-03-2019 10:39 AM
[SOLVED] xterm - termcap or terminfo Gerard Lally Slackware 2 05-16-2017 04:50 PM
How to configure Xterm colors if my xterm can support 256 colors n179911 Linux - Software 4 07-06-2009 02:28 AM
terminfo, xterm compatibility between linux and solaris Sfpiano Linux - Software 4 12-15-2005 04:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:30 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