Colourful console in FreeBSD

I moved a few months ago. Moving from time to time is probably a Good Thing™. While going through my stuff, I came across a printout of this posting to the freebsd-stable mailling list back in 2007.

On a virtual machine running FreeBSD 8.2-STABLE and booting off a couple of ZFS mirrored root disks, I created the file /usr/src/sys/i386/conf/COLOURFUL and placed these lines in that file:

include GENERIC
ident COLOURFUL
options SC_HISTORY_SIZE=2000
options SC_NORM_ATTR=(FG_LIGHTGREEN|BG_BLACK)
options SC_NORM_REV_ATTR=(FG_YELLOW|BG_BLACK)
options SC_KERNEL_CONS_ATTR=(FG_LIGHTBLUE|BG_BLACK)
options SC_KERNEL_CONS_REV_ATTR=(FG_LIGHTRED|BG_BLACK)

Next, /etc/make.conf was changed to allow for the use of the COLOURFUL kernel instead of the GENERIC kernel:

KERNCONF=COLOURFUL

Here’s some snapshots showing the result after recompiling and installing world and the COLOURFUL kernel:

[The first boot lines from a FreeBSD 8.2-STABLE kernel]
The first boot lines from a FreeBSD 8.2-STABLE kernel
[Just to show what ZFS versions this VM was using at the time]
Just to show what ZFS versions this VM was using at the time
[Showing the difference between kernel console output and regular console output by userland]
Showing the difference between kernel console output and regular console output by userland
[Booting completed]
Booting completed
[The first few lines of the man page for the ls command]
The first few lines of the man page for the ls command

If you use a command like vidcontrol VGA_80x25 in your ~/.bash_logout file, you’ll reset the colours on the particular vty to their default values, i.e. white on black.

# ~/.bash_logout at enterprise.ximalas.info.

tty | grep -q ttyv && ( vidcontrol VGA_80x25 && i=0; while [ "${i}" != "${TTYVHISTORYLINES}" ]; do echo; i=$[${i}+1]; done )
clear

# EOF of ~/.bash_logout.