2012-01-30

Thorbjørn Ravn Andersen's 1997 whitepaper "Colours with Linux terminals"

These days, when someone refers to the Linux console, they usually mean some kind of xterm in some kind of desktop environment. But for us old fogies, the text console, or virtual console, has not lost its allure or usefulness. Yesterday I needed to change the background color in the framebuffer text console, and this ancient whitepaper was where I found how to do it (and make it stick):

6. How to change the text-mode default from white-on-black

You will need to tell the terminal driver code that you want another default. There exists no standard way of doing this, but in case of Linux you have the setterm program.

setterm uses the information in the terminal database to set the attributes. Selections are done like
setterm -foreground black -background white -store
where the -store besides the actual change makes it the default for the current console as well. This requires that the current terminal (TERM environment variable) is described "well enough" in the termcap database. If setterm for some reason does not work, here are some alternatives:

Without the -store parameter, the color change remains in effect only until the next time a program (like ls or man) changes it back to white-on-black. For the rest of the whitepaper, see:

Colours with Linux terminals




No comments:

Post a Comment