2010年4月9日 星期五

Changing your Splashimage Font Colors in GRUB2 (2)

When you have a beautiful splashimage, the next thing to do is choose a suitable font color to go with it. Changing the font color can make a big improvement to the appearance of your GRUB Menu and splashimage.
Changing the font color would be very important if you have chosen a splashimage which contains a lot of dark shades and you're still using a black font. You might have trouble reading the titles in your GRUB menu. Changing your font color to white or a light color would be a real necessity in that situation.

We can change the font colors by editing /etc/grub.d/05_debian_theme and running 'sudo grub-mkconfig' (Karmic Koala), or 'sudo update-grub', (earlier versions of Ubuntu).

To alter the grub menu font colors, you need to edit the same file you edited to set your GRUB menu background,  /etc/grub/ 05_debian_theme.
gksudo gedit /etc/grub.d/05_debian_theme

Scroll down to about lines numbered around 33 to 43 and find this section of the file,
### BEGIN /etc/grub.d/05_debian_theme ###
insmod tga
if background_image (hd0,2)/usr/share/images/grub/Windbuchencom.tga ; then
  set color_normal=black/black
  set color_highlight=magenta/black

else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###
You may change the colors you see here highlighted in yellow.
NOTE: If you're displaying a splashimage (background), you will probably want to leave 'black' for your second normal color, that's why I didn't highlight it yellow. In GRUB2, 'black' really means transparent. If you try to set any color here, that color will hide most of your background, (splashimage).

Colors we can choose from include, black (or transparent), dark-gray, light-gray, white, brown, yellow, red, light-red, blue, light-blue, green, light-green, cyan, light-cyan,   magenta, light-magenta.
 white blue magenta cyan
 light-gray yellow red light-magenta
 dark-gray green light-blue light-red
 black light-cyan light-green brown

For example, just for demonstration purposes, pretend I have a plain lemon colored background image without anything else on it,

GNU GRUB version 1.96

Ubuntu 9.10, linux 2.6.30-8-generic                            
Ubuntu 9.10, linux 2.6.30-8-generic (single-user mode)
Ubuntu 9.10, memtest86+
Other operating systems:




Use the up or down arrow keys to select which entry is highlighted. Press enter to boot the selected OS, 'e' to edit the commands before booting, or 'c' for a command-line.

Changes to 'set color_normal=foreground/background' color settings will affect most of the text in your GRUB menu, and your background color.
As you can see in the above example, using set color_normal=green/black gives me the green font on a 'black' (transparent) background. Because of the transparent background, my  lemon colored background image shows through.

Changes to 'set color_highlight=foreground/background' color settings will only affect your highlight text, and the highlight selection bar.
Using set color_highlight=yellow/light-red gives me the yellow highlight text on the light-red highlight or selection bar.

When you're finished, remember to run update-grub or grub-mkconfig for the changes to take effect.
sudo grub-mkconfig -o /boot/grub/grub.cfg

TIP
To save yourself a lot of time, you may want to experiment with the font colors and see how they look over your new GRUB Menu background (splashimage)'on the fly', without needing to reboot.
Press your 'c' key from your GRUB Menu for GRUB2's Command Line Interface and use the set command to try out different color combinations, pressing your 'esc' key after each change to go back to your GRUB Menu to see how it looks.
See GRUB2 CLI Mode Commands for more.





LINKS

gfxterm - GRUB Wiki

Care to play with grub2-graphical? - Arch Linux Forums

GRUB 2 Graphical Menu Theme File Format - GRUB Wiki - Theme Format

沒有留言:

張貼留言

How to use simple speedtest in RaspberryPi CLI

  pi@ChunchaiRPI2:/tmp $  wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py --2023-06-26 10:4...