I have fbterm installed and I’m attempting to use it with the solarized color scheme. I have not been able to find any information about this. The colors are already added to my .Xresources and working with xterm. Is there any way to use this colorscheme in the framebuffer?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
yes/no…
yes, it appears possible, doing this using escape sequences as I pointed out was possible for a different terminal in Set solarized scheme on LXTerminal.
no, no one appears to have implemented this in a ready-to-use form because as noted in 256 colors in console (tty), the fbterm developers chose to use escape sequences different from xterm.
However, this page has a configuration which is claimed to work: dotfiles/.dircolors-fbterm, but reading the terminal description in the git repository for fbterm ( https://github.com/izmntuk/fbterm ), it apparently relies upon a version of dircolors which has been modified to generate the corresponding escape sequences.
GNU ls and dircolors do not use the terminfo (or termcap) database, hard-coding escape sequences, so any successful use of colors by those programs for fbterm would require some adaptation. I don’t see that in Fedora or Debian/testing, for instance. Other hard-coded applications offhand which may not work properly include GNU grep and groff. Because some applications ignore the terminal database, those have to be dealt with on a case-by-case basis.
Because the color definition differs from other terminals, for use with other applications it is necessary to install the terminal description which comes with fbterm (it’s not in ncurses at this time). That would be done with tic.
The terminal description uses only a nonstandard escape for setting colors, but reading the source code (vterm_action.cpp) hints that as a subset it may work for the 8 ANSI colors as well. But solarized uses more than 8 colors. If you want solarized for GNU ls, some work is needed (that no one seems to have done).
All of the preceding assumes that you have setup the color palette to match the solarized theme, and just want to use it. You could modify the script in benley/solarized-termcolor-osc4 to use the escape sequence in the fbterm terminal description and get something workable that way. That’s done in this line:
printf "x1b]4;$ANSI;rgb:${RGB}a"
which is hard-coded. If they’d used tput, there would be no work involved. The terminal description for fbterm says
initc=E[3;%p1%d;%p2%d;%p3%d;%p4%d},
which (noting that the script uses / throughout) would correspond to a statement like
printf '33[3;%d;%d;%d;%d}' $ANSI $R $G $B
if the script had been written to set variables for Red, Green and Blue. If you modified it to change those embedded / characters to ; then the printf would fit in the existing script like this:
printf '33[3;%d;%s}' $ANSI "$RGB"
but those embedded semicolons would make it necessary to add quotes around the parameters to each call of cset.
Method 2
Really? TWO downvotes? I DO use this script AND its been deemed “the right answer”. WTF?
Following up on @Thomas Dickey’s answer with regards to solarized script
fbterm’s initc uses decimal values not hexidecimal values so you will need to rewrite most of it. Once done, it is invoked within another script (eg /etc/profile or ~/.bashrc) using:
. solarized-fbterm.sh
Luckily I already have done this, solarized-fbterm.sh:
#!/bin/bash
#
# Author: <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99e9f8ecf5b7eeebf8ededd9fef4f8f0f5b7faf6f4">[email protected]</a> (Paul Wratt)
# Original: <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0260676c6e677b42656f636b6e2c616d6f">[email protected]</a> (Benjamin Staffin)
# Set your fbterm's color palette to match the Solarized color scheme by
# using escape sequences. fbterm uses decimal values not hex values.
#
set -o nounset
base03="0;43;54"
base02="7;54;66"
base01="88;110;117"
base00="101;123;131"
base0="131;148;150"
base1="147;161;161"
base2="238;232;213"
base3="253;246;227"
yellow="181;137;0"
orange="203;75;22"
red="220;50;47"
magenta="211;54;130"
violet="108;113;196"
blue="38;139;210"
cyan="42;161;152"
green="133;153;0"
printf "33[3;234;$base03}33[3;235;$base02}33[3;240;$base01}33[3;241;$base00}33[3;244;$base0}33[3;245;$base1}33[3;254;$base2}33[3;230;$base3}33[3;136;$yellow}33[3;166;$orange}33[3;160;$red}33[3;125;$magenta}33[3;61;$violet}33[3;33;$blue}33[3;37;$cyan}33[3;64;$green}"
function cset() {
ANSI=$1
RGB=$2
printf "33[3;%d;%s}" $ANSI "$RGB"
}
#black
cset 0 $base02
cset 8 $base03
#red
cset 1 $red
cset 9 $orange
#green
cset 2 $green
cset 10 $base01
#yellow
cset 3 $yellow
cset 11 $base00
#blue
cset 4 $blue
cset 12 $base0
#magenta
cset 5 $magenta
cset 13 $violet
#cyan
cset 6 $cyan
cset 14 $base1
#white
cset 7 $base2
cset 15 $base3
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0