The following notes apply to virtual terminals such as /dev/tty1, /dev/tty2, etc.
You use these terminals when you log in without a display manager (eg. LightDM) or when you use a command such as <ctrl> + <alt> + <F2>.
These settings will not apply to a terminal emulator such as urxvt, st or xterm etc. They will need to to be configured separately.
The following instructions were created on Debian 10 (buster).
They should work on Ubuntu and other Debian based distributions as well.
kbd:sudo apt install kbd
Add the setvtrgb executable to the initramfs so that it's available during boot.
sudoedit /etc/initramfs-tools/hooks/setvtrgb_hook
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
copy_exec /usr/bin/setvtrgb /bin
sudo chmod +x /etc/initramfs-tools/hooks/setvtrgb_hook
Test the colorscheme by running the script then clearing the terminal. This way you can see which one you like ahead of time.
/etc/initramfs-tools/scripts/init-top/sudo chmod +x /etc/initramfs-tools/scripts/init-top/my_colorscheme
After completing the above steps, we will generate the new initramfs
sudo update-initramfs -u
lsinitramfs -l /boot/initrd.img-4.19.0-9-amd64 | grep setvtrgb
If you use Plymouth, a display manager or frankly just don't care if the boot process terminal has custom colors, you can create a systemd service to load the colors after login.
/etc/custom-vt-colors.sudoedit /etc/systemd/system/custom-vt-colors.service
[Unit] Description=Load custom VT color palette [Service] Type=oneshot ExecStart=/usr/bin/setvtrgb /etc/custom-vt-colors [Install] WantedBy=multi-user.target
sudo systemctl enable --now custom-vt-colors.service
For the colorschemes below (except default), I imported the Xresources of each colorscheme to https://terminal.sexy to convert the hex values to rgb quickly. Then I created the files using those rgb values.
setvtrgb requires the input to be formatted properly for it to work.
Similar to Xresources, there are definable 16 colors ranging from color0 through color15. However, the colors need split into 3 lines with Red being the top line, Green being the middle line and Blue being the bottom line. It should look like this (substituting the RGB values of course):
Red0,Red1,Red2,Red3,Red4,Red5,Red6,Red7,Red8,Red9,Red10,Red11,Red12,Red13,Rew14,Red15 Green0,Green1,Green2,Green3,Green4,Green5,Green6,Green7,Green8,Green9,Green10,Green11,Green12,Green13,Rew14,Green15 Blue0,Blue1,Blue2,Blue3,Blue4,Blue5,Blue6,Blue7,Blue8,Blue9,Blue10,Blue11,Blue12,Blue13,Rew14,Blue15
For a working example and/or to make a backup of the current settings:
cat /sys/module/vt/parameters/default_{red,grn,blu} > ~/consolecolors
#!/usr/bin/env bash hex_regex='^#?([[:xdigit:]]{6})$' # Check if input is valid hex if [[ "${1}" =~ ${hex_regex} ]]; then hexinput=$(echo "${1}" | tr '[:lower:]' '[:upper:]' | sed 's/#//g' ) else printf '%s\n' "[ERROR] ${1} is not a valid hex color code" >&2 && exit 1 fi # Print RGB output with each on it's own line printf '%d\n' "0x${hexinput:0:2}" "0x${hexinput:2:2}" "0x${hexinput:4:2}" # vim: ft=sh ts=2 sts=2 sw=2 sr et
hexrgb.sh ff9900 or hexrgb.sh \#ff9900 or hexrgb.sh "#ff9900"man initramfs-toolsman setvtrgb