5

I managed to change the background on the boot screen and now I need to set the font colours to something I can read. I've been lurking around the Ubuntu Forums and the Ask site and I've also tried with the grub-customizer with no luck. All I need is the right code for grub file.

Here's a copy of my current grub:

GRUB_DEFAULT="saved"
GRUB_SAVEDEFAULT="true"
#GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_BACKGROUND="/home/autumn/Pictures/grub/suckng.jpg"

menu_color_normal=black/black
menu_color_highlight=yellow/dark-gray
color_normal=black/black
color_higlight=black/black

2 Answers 2

7

I had this problem in ubuntu 13.10 with grub-customizer. In my case it was caused by reverting to the default debian theme, which made the image appear in the background, but all text was grey. I solved it by editing the 05_debian_theme file found in /etc/grub.d/

$ sudo gedit /etc/grub.d/05_debian_theme

Find where it reads:

if [ -z "${2}" ] && [ -z "${3}" ]; then
        echo "  true"
fi

Change to:

if [ -z "${2}" ] && [ -z "${3}" ]; then
    echo "  true"
    echo "    set color_highlight=light-blue/black"
    echo "    set color_normal=white/black"
fi

Replace the colours with that of your choosing, remembering grub treats 'black' as transparent. Then run the following and reboot:

sudo update-grub

If that does not solve it for you go go back and edit the theme as mentioned above. You will see a section:

set_default_theme(){
case $GRUB_DISTRIBUTOR in
    Ubuntu|Kubuntu)
        # Set a monochromatic theme for Ubuntu.
        echo "${1}set menu_color_normal=white/black"
        echo "${1}set menu_color_highlight=light-blue/black"

        if [ -e /lib/plymouth/themes/default.grub ]; then
            sed "s/^/${1}/" /lib/plymouth/themes/default.grub
        fi
        ;;
    *)
        # Set the traditional Debian blue theme.
        echo "${1}set menu_color_normal=white/black"
        echo "${1}set menu_color_highlight=light-blue/black"
        ;;

Change the colours to what you require then update-grub, reboot.

Good luck, I hope this helps.

0
0

Solution: /etc/grub.d/06_local_colors

The problem is that update-grub recreates your grub.cfg. The usual way to configure update-grub in Ubuntu is to edit /etc/default/grub, but unfortunately text colors are not yet supported.

We will use a lower level method: create a script in /etc/grub.d/ which will output the lines we want in the grub.cfg files. We use the name 06_local_colors so that it will run after 05_debian_theme and override the color choices.

There are three easy steps.

Step 1. sudo editor /etc/grub.d/06_local_colors

Paste in this script:

#!/bin/sh
# /etc/grub.d/06_local_colors
# Override foreground/background colors with local admin's choices.  
#
# Note: be sure to chmod +x this file or it will not be used.
# After editing this file, run update-grub.
set -e
echo "Overriding foreground/background text colors ($0)" >&2

echo "${1}set color_normal=light-gray/black"
echo "${1}set color_highlight=black/light-gray"

# Set these if you'd like the menu options to be different than other text
echo "${1}set menu_color_normal=light-gray/black"
echo "${1}set menu_color_highlight=black/light-gray"

# NOTES

# Colors: red, green, blue, cyan, magenta, brown, light-gray, black
#
# Foreground has additional colors available:
#
#         light-red, light-green, light-blue
#         light-cyan, light-magenta, yellow, white, dark-gray

# Text background of "black" is transparent when a background image exists.
# (GRUB_BACKGROUND in /etc/default/grub).

# To change the font face and size, set GRUB_FONT in /etc/default/grub 
# to point to a .pf2 file crated by grub-mkfont.
# 
# sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono24.pf2 --size=24 \
#           /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf 

The script contains abundant notes so it should be quite simple to tweak.

Step 2: sudo chmod +x /etc/grub.d/06_local_colors

The file needs to be executable or it will not be used.

Step 3: sudo update-grub

After update completes successfully, simply reboot to see what your new colors look like in GRUB.


Further reading

Side note: Why not 05_debian_themes?

While it is possible to edit the system file 05_debian_theme, as described in other answers, it is a bad idea. That file can may need to be overwritten when the system is updated.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .