[SOLVED] xterm 256 colours after migration to terminfo in -current
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.