LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 07-12-2016, 09:32 PM   #1
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Rep: Reputation: 169Reputation: 169
Change color of font in grub menu


Going by what is here, I am trying to change the font color of my grub menu.
But there are no color changes. (I also did sudo grub-mkconfig -o /boot/grub/grub.cfg)

http://www.thegeekstuff.com/2012/10/grub-splash-image/

Here is a section of 05-debian_theme where I made changes.

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

			if [ -e /usr/share/plymouth/themes/default.grub ]; then
				sed "s/^/${1}/" /usr/share/plymouth/themes/default.grub
			fi
			# For plymouth backward compatiblity. Can be removed
			# after xenial.
			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/blue"
			echo "${1}set menu_color_highlight=green/white"
			;;
	esac
}

Last edited by Fixit7; 07-12-2016 at 09:33 PM.
 
Old 07-12-2016, 11:14 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,508

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
The instructions down the page at the Ubuntu site below worked as expected for me. It's a little more detailed then the link you posted.

https://help.ubuntu.com/community/Grub2/Displays
 
Old 07-13-2016, 06:49 AM   #3
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Grub just insists on using their default fonts and colors. :-(

Quote:
#!/bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2010 Alexander Kurtz <kurtz.alex@googlemail.com>
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.

# Include the GRUB helper library for grub-mkconfig.
. /usr/share/grub/grub-mkconfig_lib

# We want to work in /boot/grub/ only.
test -d /boot/grub; cd /boot/grub

# Set the location of a possibly necessary cache file for the background image.
# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.
BACKGROUND_CACHE=".background_cache"

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

if [ -e /usr/share/plymouth/themes/default.grub ]; then
sed "s/^/${1}/" /usr/share/plymouth/themes/default.grub
fi
# For plymouth backward compatiblity. Can be removed
# after xenial.
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/blue"
echo "${1}set menu_color_highlight=green/white"
;;
esac
}

module_available(){
local module
for module in "${1}.mod" */"${1}.mod"; do
if [ -f "${module}" ]; then
return 0
fi
done
return 1
}

set_background_image(){
# Step #1: Search all available output modes ...
local output
for output in ${GRUB_TERMINAL_OUTPUT}; do
if [ "x$output" = "xgfxterm" ]; then
break
fi
done

# ... and check if we are able to display a background image at all.
if ! [ "x${output}" = "xgfxterm" ]; then
return 1
fi

# Step #2: Check if the specified background image exists.
if ! [ -f "${1}" ]; then
return 2
fi

# Step #3: Search the correct GRUB module for our background image.
local reader
case "${1}" in
*.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpeg";;
*.png|*.PNG) reader="png";;
*.tga|*.TGA) reader="tga";;
*) return 3;; # Unknown image type.
esac

# Step #4: Check if the necessary GRUB module is available.
if ! module_available "${reader}"; then
return 4
fi

# Step #5: Check if GRUB can read the background image directly.
# If so, we can remove the cache file (if any). Otherwise the backgound
# image needs to be cached under /boot/grub/.
if is_path_readable_by_grub "${1}"; then
rm --force "${BACKGROUND_CACHE}.jpeg" \
"${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga"
elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then
set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}"
else
return 5
fi

# Step #6: Prepare GRUB to read the background image.
if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${1}"`"; then
return 6
fi

# Step #7: Everything went fine, print out a message to stderr ...
echo "Found background image: ${1}" >&2

# ... and write our configuration snippet to stdout. Use the colors
# desktop-base specified. If we're using a user-defined background, use
# the default colors since we've got no idea how the image looks like.
# If loading the background image fails, use the default theme.
echo "insmod ${reader}"
echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"

# my grub colours
echo " set color_normal=cyan/black"
echo " set color_highlight=yellow/black"


if [ -n "${2}" ]; then
echo " set color_normal=${2}"
fi
if [ -n "${3}" ]; then
echo " set color_highlight=${3}"
fi
if [ -z "${2}" ] && [ -z "${3}" ]; then
echo " true"
fi
echo "else"
set_default_theme " "
echo "fi"
}

# Earlier versions of grub-pc copied the default background image to /boot/grub
# during postinst. Remove those obsolete images if they haven't been touched by
# the user. They are still available under /usr/share/images/desktop-base/ if
# desktop-base is installed.
while read checksum background; do
if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" = "x${checksum} ${background}" ]; then
echo "Removing old background image: ${background}" >&2
rm "${background}"
fi
done <<EOF
648ee65dd0c157a69b019a5372cbcfea4fc754a5 debian-blueish-wallpaper-640x480.png
0431e97a6c661084c59676c4baeeb8c2f602edb8 debian-blueish-wallpaper-640x480.png
968ecf6696c5638cfe80e8e70aba239526270864 debian-blueish-wallpaper-640x480.tga
11143e8c92a073401de0b0fd42d0c052af4ccd9b moreblue-orbit-grub.png
d00d5e505ab63f2d53fa880bfac447e2d3bb197c moreblue-orbit-grub.png
f5b12c1009ec0a3b029185f6b66cd0d7e5611019 moreblue-orbit-grub.png
EOF

# Include the configuration of desktop-base if available.
if [ -f "/usr/share/desktop-base/grub_background.sh" ]; then
. "/usr/share/desktop-base/grub_background.sh"
fi

# First check whether the user has specified a background image explicitly.
# If so, try to use it. Don't try the other possibilities in that case
# (#608263).
if [ -n "${GRUB_BACKGROUND+x}" ]; then
set_background_image "${GRUB_BACKGROUND}" || set_default_theme
exit 0
fi

# Next search for pictures the user put into /boot/grub/ and use the first one.
for background in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA; do
if set_background_image "${background}"; then
exit 0
fi
done

# Next try to use the background image and colors specified by desktop-base.
if set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then
exit 0
fi

# If we haven't found a background image yet, use the default from desktop-base.
case $GRUB_DISTRIBUTOR in
Ubuntu|Kubuntu)
;;
Tanglu)
if set_background_image "/usr/share/images/grub/grub.png"; then
exit 0
fi
;;
*)
if set_background_image "/usr/share/images/desktop-base/desktop-grub.png"; then
exit 0
fi
;;
esac
# Finally, if all of the above fails, use the default theme.
set_default_theme
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change Grub menu.lst text color? linus72 Linux - Newbie 16 06-03-2009 06:48 PM
How to change font color and font size in terminal ? wlaw Linux - Newbie 3 05-15-2007 08:57 PM
change the font color Drunkalot Linux - General 2 08-09-2005 10:37 PM
change the console font color minike Slackware 3 08-30-2004 05:11 PM
change font color...no NOT in X centr0 Slackware 4 05-01-2003 03:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 10:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration