Blame


1 f3a795ae 2021-08-03 op 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.
2 f3a795ae 2021-08-03 op
3 f3a795ae 2021-08-03 op 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.
4 f3a795ae 2021-08-03 op
5 f3a795ae 2021-08-03 op (w3m is quite a fine browser, maybe I’ll try to create something akin to it for Gemini.)
6 f3a795ae 2021-08-03 op
7 f3a795ae 2021-08-03 op 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!
8 f3a795ae 2021-08-03 op
9 f3a795ae 2021-08-03 op 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.
10 f3a795ae 2021-08-03 op
11 f3a795ae 2021-08-03 op The “template” for these codes are:
12 f3a795ae 2021-08-03 op
13 f3a795ae 2021-08-03 op ```sh
14 f3a795ae 2021-08-03 op \033 ] P <index> <html-hex-color>
15 f3a795ae 2021-08-03 op ```
16 f3a795ae 2021-08-03 op
17 f3a795ae 2021-08-03 op (spaces only for readability)
18 f3a795ae 2021-08-03 op
19 f3a795ae 2021-08-03 op 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.
20 f3a795ae 2021-08-03 op
21 f3a795ae 2021-08-03 op I’m using the following colors, but you can customize them to match your preferred scheme:
22 f3a795ae 2021-08-03 op
23 f3a795ae 2021-08-03 op ```sh
24 f3a795ae 2021-08-03 op printf "\033]P0000000" #black
25 f3a795ae 2021-08-03 op printf "\033]P1803232" #darkred
26 f3a795ae 2021-08-03 op printf "\033]P25b762f" #darkgreen
27 f3a795ae 2021-08-03 op printf "\033]P3aa9943" #brown
28 f3a795ae 2021-08-03 op printf "\033]P4324c80" #darkblue
29 f3a795ae 2021-08-03 op printf "\033]P5706c9a" #darkmagenta
30 f3a795ae 2021-08-03 op printf "\033]P692b19e" #darkcyan
31 f3a795ae 2021-08-03 op printf "\033]P7ffffff" #lightgrey
32 f3a795ae 2021-08-03 op printf "\033]P8222222" #darkgrey
33 f3a795ae 2021-08-03 op printf "\033]P9982b2b" #red
34 f3a795ae 2021-08-03 op printf "\033]PA89b83f" #green
35 f3a795ae 2021-08-03 op printf "\033]PBefef60" #yellow
36 f3a795ae 2021-08-03 op printf "\033]PC2b4f98" #blue
37 f3a795ae 2021-08-03 op printf "\033]PD826ab1" #magenta
38 f3a795ae 2021-08-03 op printf "\033]PEa1cdcd" #cyan
39 f3a795ae 2021-08-03 op printf "\033]PFdedede" #white
40 f3a795ae 2021-08-03 op ```
41 f3a795ae 2021-08-03 op
42 f3a795ae 2021-08-03 op Then, it’s possible to change the foreground and background as usual, but there’s an extra escape code to “persist” the combination:
43 f3a795ae 2021-08-03 op
44 f3a795ae 2021-08-03 op ```sh
45 f3a795ae 2021-08-03 op # set the default background color (47, aka white) and the default
46 f3a795ae 2021-08-03 op # foreground color (30, aka black), then store it (aka [8])
47 f3a795ae 2021-08-03 op printf '\033[47;1;30m\033[8]'
48 f3a795ae 2021-08-03 op ```
49 f3a795ae 2021-08-03 op
50 f3a795ae 2021-08-03 op Here’s the outcome:
51 f3a795ae 2021-08-03 op
52 f3a795ae 2021-08-03 op => /img/linux-bright-colorscheme.jpg Bright tty, screenshot (282K)