Blob


1 Last week I spent a couple of days at my relative house. The only thing I took with me was a raspberry, plugged to the TV.
3 The raspberry was running void linux, with only a small selection of software installed on it (Emacs, git, a C toolchain and nothing more, neither X11), and it was refreshing! Most of the time the system was offline so I could focus on writing code, with only some occasional trips to man.openbsd.org with w3m to read some decent manpages.
5 (w3m is quite a fine browser, maybe I’ll try to create something akin to it for Gemini.)
7 The thing is, I am one of those strange people who doesn’t like dark colorschemes. “Black print on white paper, as God and Gutenberg intended.” Unfortunately the linux ttys are white text on a black background. Let’s fix that!
9 I found (and forgot the link) that linux allows one to customize the colors via ANSI escape codes and also set the default foreground and background.
11 The “template” for these codes are:
13 ```sh
14 \033 ] P <index> <html-hex-color>
15 ```
17 (spaces only for readability)
19 where ‘\033’ is the escape character, index is a one hex digit (0-F) and ‘html-hex-color’ is the familiar “HTML-style” six hexadecimal digit color.
21 I’m using the following colors, but you can customize them to match your preferred scheme:
23 ```sh
24 printf "\033]P0000000" #black
25 printf "\033]P1803232" #darkred
26 printf "\033]P25b762f" #darkgreen
27 printf "\033]P3aa9943" #brown
28 printf "\033]P4324c80" #darkblue
29 printf "\033]P5706c9a" #darkmagenta
30 printf "\033]P692b19e" #darkcyan
31 printf "\033]P7ffffff" #lightgrey
32 printf "\033]P8222222" #darkgrey
33 printf "\033]P9982b2b" #red
34 printf "\033]PA89b83f" #green
35 printf "\033]PBefef60" #yellow
36 printf "\033]PC2b4f98" #blue
37 printf "\033]PD826ab1" #magenta
38 printf "\033]PEa1cdcd" #cyan
39 printf "\033]PFdedede" #white
40 ```
42 Then, it’s possible to change the foreground and background as usual, but there’s an extra escape code to “persist” the combination:
44 ```sh
45 # set the default background color (47, aka white) and the default
46 # foreground color (30, aka black), then store it (aka [8])
47 printf '\033[47;1;30m\033[8]'
48 ```
50 Here’s the outcome:
52 => /img/linux-bright-colorscheme.jpg Bright tty, screenshot (282K)