1

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?

1

Followin up on to @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, solarized-fbterm.sh:

#!/bin/bash
#
# Author: paul.wratt@gmail.com (Paul Wratt)
# Original: benley@gmail.com (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 "\033[3;234;$base03}\033[3;235;$base02}\033[3;240;$base01}\033[3;241;$base00}\033[3;244;$base0}\033[3;245;$base1}\033[3;254;$base2}\033[3;230;$base3}\033[3;136;$yellow}\033[3;166;$orange}\033[3;160;$red}\033[3;125;$magenta}\033[3;61;$violet}\033[3;33;$blue}\033[3;37;$cyan}\033[3;64;$green}"

function cset() {
  ANSI=$1
  RGB=$2
  printf "\033[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
  • Sadly when I run the script, it does nothing O_o – Dmitry Kudriavtsev Aug 27 '17 at 3:42
  • I edited the post to show how it (either solarized scripts) are to be used – Paul Wratt Aug 27 '17 at 3:50
  • Any way to set FG/BG colors? – Dmitry Kudriavtsev Aug 27 '17 at 3:56
  • use "tput AF n" and "tput AB n" - that will work across terminals – Paul Wratt Aug 27 '17 at 3:58
  • NO this will still not affect the output of "ls" or "grep" or any other app that is hardcoded internally, because fbterm uses "non-standard" xterm color escape sequences. You need to use apps that are written with "tget" and "yput" terminfo support (eg "bas"). – Paul Wratt Aug 27 '17 at 4:01
3

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 '\033[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 '\033[3;%d;%s}' $ANSI "$RGB"

but those embedded semicolons would make it necessary to add quotes around the parameters to each call of cset.

  • Doesn't that file only work with ls and other dircolors programs? AFAIK the terminal doesn't respect the dir colors. – Dmitry Kudriavtsev Oct 17 '16 at 19:26
  • Most people asking about solarized don't seem to care about anything else (except for a separate configuration using vim), so I mentioned the point. By the way, the terminal description isn't in ncurses, would only get installed via a package for fbterm. – Thomas Dickey Oct 17 '16 at 20:11
  • I want the full solarized color scheme such as this: i.sli.mg/C3ZZMW.png – Dmitry Kudriavtsev Oct 17 '16 at 20:14
  • vim can use the terminal description if you install it using tic. – Thomas Dickey Oct 17 '16 at 20:17
  • Technically that's your PS1 setting (which would have to be either written in terms of tput, or some other change). bash itself doesn't care much what the escapes are between \[ and \]. – Thomas Dickey Oct 17 '16 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.