LinuxCommandLibrary

grub-render-label

Preview GRUB menu entries

SYNOPSIS

grub-render-label [OPTION...] [STRING]

PARAMETERS

-b, --background=COLOR
    set background color (hex, e.g., #000000)

-d, --directory=DIR
    use images/fonts in DIR [default=/boot/grub]

-f, --foreground=COLOR
    set foreground color (hex, e.g., #ffffff)

-o, --output=FILE
    output to FILE [default=stdout]

-s, --size=SIZE
    set menu entry height in pixels [default=24]

-t, --target=TARGET
    set target image size [default=auto]

-h, --help
    display this message and exit

-v, --version
    print version information

DESCRIPTION

The grub-render-label command is a utility from the GRUB2 bootloader package that generates PNG images of text strings formatted as labels for GRUB menu entries. It is primarily used to create custom graphical labels for boot menu items in GRUB's graphical or themed interfaces.

GRUB menu labels are the short text descriptions shown next to boot options. This tool renders them using GRUB's built-in fonts and color schemes, ensuring consistency with the bootloader's theme. Users specify the label text, colors (foreground and background as hex values), output size, and directory for GRUB assets like fonts.

Common workflow: Pipe output to a file or integrate into GRUB theme generation scripts. For example, theme developers use it to pre-render labels for static menus. It defaults to /boot/grub for assets and outputs to stdout unless specified. Supports auto-sizing or fixed heights, making it ideal for high-DPI or standard displays.

Lacks advanced typography but excels in simplicity for bootloader contexts. Essential for customizing GRUB2 appearances without full image editors.

CAVEATS

Always outputs PNG; hex colors must be valid (e.g., #rrggbbaa); requires GRUB fonts in directory; no font selection option.

EXAMPLE

grub-render-label -s 32 -f #ffffff -b #000080 'Linux' > label.png
Generates a 32px high label image.

DEFAULT BEHAVIOR

Without STRING, renders empty label; auto-detects size based on font metrics.

HISTORY

Introduced in GRUB2 (circa 2005-2008) to support graphical themes; evolved with GRUB 2.x for better PNG rendering and theming.

SEE ALSO

Copied to clipboard