This page has been migrated to the Ubuntu Community Documentation site. For the most up-to-date information, please visit:
https://help.ubuntu.com/community/Grub2/Displays
The above page is a sub-page of the main community documentation regarding https://help.community/Grub2.
Thank you to all the users who posted in these threads and expanded our knowledge of Grub 2 since it's introduction.
A thread for discussion of the wiki can be found at http://ubuntuforums.org/showthread.php?p=12073029
Support threads regarding the wiki and it's content should be created in a suitable forum.
----
First, a disclaimer. Grub 1.99 RC1 will be distributed with Ubuntu 11.04, Natty Narwhal. Dropping a background image into /boot/grub will not work with Grub 1.98 or earlier, but there are other methods discussed in this guide that will. All Grub 2 users can use this guide to help select font & background colors.
Users looking for information about themes will not find it in this thread. Sorry.
GRUB 1.99 Background Images
Copy a .jpg, .png or .tga image to /boot/grub, update Grub, and you now have a Grub menu background. If you haven't previously set up an image or theme, it can be that simple!
Ubuntu repositories provides a sampling of Grub 2 splashimages suitable for background use. The package is grub2-splashimages. Once installed, the images are stored in /usr/share/images/grub
Note: If the image name includes spaces, the image is copied to a (hidden) file named .background_cache.* and an "unexpected operator" message is generated while running 'update-grub'. The image will still appear during boot, with Grub2 using the file /boot/grub/.background_cache.*. Thanks to forum member Anduu for posting this behavior.
Besides the simplicity of activating a background, Grub 2 now should auto-detect video capabilities and provide what it considers the best resolution. It will stretch any image to fill the screen. It's pretty easy to add a bit of eye candy.
Procedure:
- Copy any image (jpg, png or tga) to the /boot/grub folder.
- Run "sudo update-grub".
- Done. How easy was that?
Additional Info:
Image Priority:
- GRUB_BACKGROUND=</path/filename> setting in /etc/default/grub
- Available in updated versions of Grub 1.98
- Example: GRUB_BACKGROUND=/boot/grub/myimages/eyecandy.png
- First image found in /boot/grub
- The first image found, in this order: jpg, JPG, jpeg, JPEG, png, PNG, tga, TGA
- If multiple images of the same extension, alphanumerically.
- Wallpaper designated in /usr/share/desktop-base/grub_backgorund.sh (if desktop-base installed)
- /usr/share/images/desktop-base/desktop-grub.png (if desktop-base is installed)
- Default theme (no image): Aubergine background, selected item black on light gray background)
Gotchas
- Don't forget to run "sudo update-grub"
- If you have multiple distros on your system, remember the change must be made to the controlling Grub
- Grub 1.99 RC or later.
- Images should be RGB, i.e. non-indexed (in GIMP, Image > Mode) and jpeg images should be 8-bit.
When the user specifies a custom background, the Grub developers decided to be conservative and specified a black/white font scheme. They were kind enough to include a comment about it in /etc/grub.d/05_debian_theme but left it to the user to figure out how to deal with the font colors when using custom backgrounds. Font color selection is discussed in the next section.
Font Colors & Backgrounds
First, keep in mind that Grub 2 considers black used as the second color entry as transparent. You will see the background image wherever black is the second entry (e.g. green/black = green text on transparent background).
- color1/color2
Two colors must be designated when assigning colors, separated by a /
I'll call them color1 and color2 in this guide.
According to the GNU GRUB manual, the colors can be designated as HTML-style (#000000), comma-separated RGB (128,255,255), and SVG 1.0 lowercase color names (midnightblue). To date, I have had success using the following designations:
black blue brown cyan dark-gray green light-cyan light-blue light-green light-gray light-magenta light-red magenta red white yellow
- color1 is the text color
- color2 is the background color or transparency (black)
- color2 must be 'black' for a background image to be visible.
- 'black' as color2 is regarded as transparent.
- Any other color will hide all or part of any background image being used.
- Menu Settings
There are two conditions (normal & highlight) and two locations (menu or unspecified) possible within the Grub menu:
- Conditions
- Highlighted or selected text
- The selected line is highlighted fully across the entire line, producing a 'bar'.
- color1 determines the font color. color2 determines the bar color.
- Non-highlighted or unselected text.
- color1 determines the font color. color2 determines the background color or transparency of all non-highlighted areas.
- Locations
- menu_color_ : The area within the menu border.
- color_ : The area outside the menu borders. It will also control items within the menu border if menu_color_ is not specified.
The following are the entries which will be added to /etc/grub.d/05_debian_theme in the next section.
- Selected Entry within the Grub Menu Border (one line) is controlled by:
Code:menu_color_highlight=color1/color2- Colors of selected text & background within the Grub2 menu border.
- Defaults to color_highlight settings if not specified.
- Non-selected entries within the Grub Menu Border (the rest) are controlled by:
Code:menu_color_normal=color1/color2- Colors of non-selected text & background within the Grub2 menu border.
- Defaults to color_normal settings if not specified.
- Highlighted Text Outside the Grub Border (one line) is controlled by:
Code:color_highlight=color1/color2- If there is no menu_color_highlight entry this setting is used within the Grub2 menu border for the selected entry line.
- Text/Colors Outside the Grub Border are controlled by:
Code:color_normal=color1/color2- Colors of text & background outside the Grub2 menu border.
- If there is no menu_color_normal entry this setting is used within the Grub2 menu border for the non-selected areas.
An Example
menu.png
The background image was a black screen with an Ubuntu logo. The image is visible within the menu border since both "menu_color..." entries have black as the second color. The image is not visible outside the menu box since the "color_normal" color2 is not 'black' (transparent).
menu_color_normal=white/black
menu_color_highlight=yellow/black
color_normal=green/red
color_highlight=black/white (Not illustrated)
Editing Font Colors
- As root, open /etc/grub.d/05_debian_theme for editing. The sections to be edited is currently at approximately line 98 (line 105 in Grub 1.99):
Code:gksu gedit +98 /etc/grub.d/05_debian_theme
- Add lines 2 & 3, using the colors you desire, in two places.
echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"
echo " set color_normal=light-gray/black"
echo " set color_highlight=green/black"
if [ -n "${2}" ]; thenif [ -z "${2}" ] && [ -z "${3}" ]; then
echo " set color_normal=light-gray/black"
echo " set color_highlight=green/black"
echo " true"
fi- Save the file, then update Grub.
Code:sudo update-grub
Real-Time Testing Graphics & Font Colors at the Grub2 menu
Font & background changes take effect immediately when editing the Grub 2 menu from the grub prompt, so immediate feedback while testing color combinations is possible.
- At the Grub2 menu (hold SHIFT during boot if it doesn't display. But hey, if it doesn't display why are you wasting time with a grub background ).
- Press 'c' to get the grub prompt.
- Change the background image:
Code:background_image <path/filename>
- Example: background_image /boot/grub/natty.png # Assumes prefix is set to (hdX,Y)/boot/grub
- Change the font & background colors:
Code:set <selection>=color1/color2
- Example: set menu_color_highlight=yellow/blue
- To see all current settings type set at the grub prompt.
- Changes to color_normal are seen immediately at the grub prompt. To see the menu changes press ESC to return to the Grub2 menu.
Don't forget
- You are just testing the settings at the Grub prompt/menu. Once you have settled on your color combinations, boot, make the changes to /etc/grub.d/05_debian_theme, save the file.
- update-grub for the changes to be incorporated in grub.cfg.
This guide is a compilation of several threads/posts originally in the Natty Testing Forum.
Other Grub 1.99 Links:
Grub 1.99 Changes
Grub 1.99 Submenus
Bookmarks