Creating grub themes

Manjaro (and many other distros) installs come ready with a starfield theme.
By modifying this, we can have our very own customized grub menu theme.
We can of course use other themes from elsewhere.
And there have been other contributions in Manjaro
The following are the basic steps.

Modify grub.cfg
Modify grub.cfg as follows.
I use my own independent grub from here (after the ###### "set up " ####### section)
But we can set it up in /etc/default/grub to use our OS grub following the parameters below


#############################     VIDEO      ##############################


set gfxpayload=1280x1024x32
gfxmode=1280x1024x32

#  set gfxpayload=1024x768x32
#  gfxmode=1024x768x32

# set gfxpayload=640x480x32
# gfxmode=640x480x32


insmod all_video
# load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext

terminal_output gfxterm
insmod gfxmenu
insmod png
insmod font

# loadfont ($root)/boot/grub/fonts/unicode.pf2
loadfont ($root)/boot/grub/fonts/dejavu_10.pf2
loadfont ($root)/boot/grub/fonts/dejavu_12.pf2
loadfont ($root)/boot/grub/fonts/dejavu_14.pf2
loadfont ($root)/boot/grub/fonts/dejavu_16.pf2
loadfont ($root)/boot/grub/fonts/dejavu_bold_14.pf2
loadfont ($root)/boot/grub/fonts/DejaVuSans-Bold-14.pf2
loadfont ($root)/boot/grub/fonts/DejaVuSans-Bold-18.pf2
loadfont ($root)/boot/grub/fonts/DejaVuSans-Bold-20.pf2
loadfont ($root)/boot/grub/fonts/DejaVuSans-Bold-24.pf2
loadfont ($root)/boot/grub/fonts/MageiaLogo-Bold-16.pf2
loadfont ($root)/boot/grub/fonts/MageiaLogo-Bold-20.pf2
loadfont ($root)/boot/grub/fonts/MageiaLogo-Bold-28.pf2
loadfont ($root)/boot/grub/fonts/MageiaLogo-Regular-20.pf2
loadfont ($root)/boot/grub/fonts/dejavu_mono_14.pf2
loadfont ($root)/boot/grub/fonts/dejavu_sans_10.pf2
loadfont ($root)/boot/grub/fonts/dejavu_sans_12.pf2
loadfont ($root)/boot/grub/fonts/unicode.pf2



# set theme=($root)/boot/grub/themes/maggy/theme.txt
# set theme=($root)/boot/grub/themes/mga3-dejavu/theme.txt
# set theme=($root)/boot/grub/themes/Dharma/theme.txt
set theme=($root)/boot/grub/themes/starfield2/theme.txt
# set theme=($root)/boot/grub/themes/ubuntu2/theme.txt


export theme
############################## end video ################################

Note I have some themes other than starfield and select by uncommenting out.
Also I loaded lots of fonts which may not be required in our example, but for my convenience, I loaded them in case other themes may require them.
I also have several resolutions and I select them accordingly. Not monitor resolutions per se but grub resolutions for the different monitors (use ‘videoinfo’).

Modify theme.txt in starfield directory
The major change is putting a desktop picture (.png format - but I think later grub versions can accept other formats)


#desktop-image: "starfield.png"
#desktop-image: "evo.png"
desktop-image: "manjaro1.png"
#desktop-image: "manjaro.png"

Again, note I have other desktop images for variety.
Uncomment out to use selected image.
The pictures are placed in the starfield directory.

Notes
o Use “#339900” for manjaro green.
o Icons - if required, populate icons in the icon directory in theme with .png images
and icons will appear with the “–class ‘icon name’” parameter.

9 Likes

Here's a screenshot of the starfield theme which comes with most manjaro versions.
Instead of the background picture that comes with it, I stole the manjaro background that is developed by @SGS and @AgentS in the 'pretty grub' theme that petsam developed.
You can use other background, just remember it has to be in png format.

Just want to show how easy it is to come up our own theme.
(and also to steal the limelight from my co-conspirator petsam :rofl: )

IIRC and as you say in OT grub can also handle at least jpg and png. Grub2-theme-preview can handle only png.
So, I don't see a warning about

Editing grub.cfg directly is not suggested, only advanced users should get in the risk.

? :wink:

I read somewhere (and some time ago too) that grub will work on using other non png pictures. I don't see this any more and I had tested on other formats like jpg and more. They unfortunately do not work still. I even renamed (just rename, not convert) one jpg file to png. Doesn't work. Oh, just tested very recently too.

As for editing grub.cfg, if you remember or had used grub-legacy, the way to fix things is to edit menu.lst (the grub.cfg equivalent) and whenever there is a grub-install or update-grub, it will revert back. I see no difference in editing grub.cfg from editing menu.lst. Of course, grub 2 is quite flexible now that we can do much of what we wanted by editing /etc/default/grub, so if we can do it by editing /etc/default/grub, we should instead of editing grub.cfg. I still won't edit /etc/grub.d files and I think that will most likely will cause issues down the road (in some future time). That is why I think grub-customizer causes so much problems (down the road) and why fedora grub (which has convoluted crazy circuitous /etc/grub.d) makes a mess (though a working mess, admittedly).

You changing grub.cfg? Of course, I think it will be safe with you. I think some others here will also be safe changing grub.cfg. I won't name people here (as I think they prefer not be named), but those who can handle grub-customizer in the long 'strange' way can benefit from just changing grub.cfg too than their current method (and therefore don't need grub-customizer anyway). BTW, I don't need to change grub.cfg as I have my own grub.cfg which never changes or need to change even with any kernel update anywhere in any of my many OS's and I really don't need to boot any distro grub except to test them.

BTW, I did ask the grub guys (long ago) why the severe and harsh warning to people wanting to edit grub.cfg and the nice reply was that without the warning, people who can't handle it will likely mess it up. They just want to prevent people like that (they think it is the majority) from making their OS unbootable. Can't argue with that.

Cheers.

1 Like

BTW, we can get to using the themes with just changing /etc/default/grub.
My example was because I use my own manual grub.cfg and I just list down the changes at my grub.cfg. To do it at /etc/default/grub, for examples...

'set gfxmode=1024x768x32" becomes "GRUB_GFXMODE=1024x768x32"

"terminal_output gfxterm" becomes "GRUB_TERMINAL_OUTPUT=gfxterm" in /etc/default/grub
"set theme=/xxx/xxx/theme.txt" becomes "GRUB_THEME="/xxx/xxxx/theme.txt"

Look at your /etc/default/grub. I think the 'translation" will become quite clear. and self-eplanatory.
My previous long post does not explain what now I think you wanted. Sorry.

My english is as bad as my chinese. aspherger I think.

[EDIT] - These alone in /etc/default/grub will work for a theme.

GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_DISTRIBUTOR=Whatever
GRUB_GFXMODE=1024x768x32
GRUB_GFXPAYLOAD_LINUX=1024x768x32
GRUB_TERMINAL_OUTPUT=gfxterm
GRUB_THEME=/boot/grub/themes/starfield/theme.txt
GRUB_TIMEOUT=15

ps: what is not in above will be default.
example : GRUB_TIMEOUT_STYLE= not listed will be
GRUB_TIMEOUT_STYLE=menu.
But does not apply for our adopted fedora grub, again as an example to show how it messes up unless we put that in and that will unmess itself. Convoluted? You bet!

As long as you include an image in /boot/grub/themes/icons/ named whatever.png, small letters, type png.
You should include this info in OT, I think.

Forum kindly sponsored by Bytemark