9-Slice Boxes Guide
How GRUB 2 pixmap boxes work, the 9 required filenames, pixel alignment rules, shadows, and common slicing mistakes.
On this page
How GRUB 2 9-slice boxes work
GRUB 2 cannot draw rounded rectangles, borders, or drop shadows procedurally. Instead, boot_menu, progress_bar, terminal-box, and selected menu highlights use styled pixmap boxes built from up to 9 separate PNG files arranged in a 3×3 grid.
When a widget grows or shrinks, GRUB keeps the four corners at their exact pixel dimensions and stretches only the edges and center piece. Explore the scaling rules interactively below:

Keep all four corner PNGs crisp with matching corner radius and shadow margin.
Naming convention (*_*.png)
In theme.txt, you pass a wildcard pattern such as "menu_*.png". GRUB automatically resolves the 9 compass suffixes relative to the theme root:
| Suffix | Position | Scaling Axis | Optional? |
|---|---|---|---|
_nw.png |
Top-left corner | None (fixed) | Optional (transparent if omitted) |
_n.png |
Top edge | Stretched horizontally (X) | Optional |
_ne.png |
Top-right corner | None (fixed) | Optional |
_w.png |
Left edge | Stretched vertically (Y) | Optional |
_c.png |
Center fill | Stretched in X and Y | Recommended |
_e.png |
Right edge | Stretched vertically (Y) | Optional |
_sw.png |
Bottom-left corner | None (fixed) | Optional |
_s.png |
Bottom edge | Stretched horizontally (X) | Optional |
_se.png |
Bottom-right corner | None (fixed) | Optional |
+ boot_menu {
left = 50%-260
top = 50%-180
width = 520
height = 360
menu_pixmap_style = "menu_*.png"
selected_item_pixmap_style = "select_*.png"
}
Step-by-step guide to creating clean 9-slices
- Design on an integer pixel grid: Start with a small card canvas (for example
64×64px) containing your border, corner radius, fill, and any outer shadow or glow. - Choose slice insets larger than your radius + shadow: If your corner radius is
10 pxand your outer shadow spreads8 px, slice at least18–20 pxfrom each edge so no curve or shadow gradient leaks into the stretched edge slices. - Verify edge-to-corner alignment:
_n.pngmust have the exact same height as_nw.pngand_ne.png._s.pngmust have the exact same height as_sw.pngand_se.png._w.pngmust have the exact same width as_nw.pngand_sw.png._e.pngmust have the exact same width as_ne.pngand_se.png.
- Keep center and edges lightweight: If the fill is solid or semi-transparent without texture,
_c.pngonly needs to be4×4px (or even1×1px). - Export all 9 files as 8-bit RGBA PNG: See Image Formats & PNG Color Depth to avoid 16-bit load failures.
How 9-slice thickness affects inner padding
GRUB 2 draws a widget's inner content inside the central _c.png region. That means the widths of _w.png and _e.png and the heights of _n.png and _s.png act as built-in padding!
- If your
selected_item_pixmap_styleuses16 pxtall_n.pngand_s.pngslices, make sureitem_heightinboot_menuis tall enough (>= 16 + 16 + font_height) so the text is never clipped. - For minimal underline or left-accent highlights, you can omit unused slices (for instance, ship only
select_w.pngandselect_c.pngfor a crisp left bar highlight).