mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2026-09-04 21:42:47 +08:00
Compare commits
4
Commits
80dd04ddf3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c5a77125b | ||
|
|
3ac5284468 | ||
|
|
241d3be041 | ||
|
|
964b323d7c |
@@ -98,6 +98,27 @@ After that, you can configure the theme as shown below. In this example it is in
|
||||
- Make sure to replace `[YOUR_RESOLUTION]` with your resolution and `[THEME]` with the theme
|
||||
- Alternatively, use the `-c` option to set a custom resolution
|
||||
|
||||
### Fonts:
|
||||
GRUB themes use the PF2 font format. GRUB rasterizes a TrueType or OpenType
|
||||
font when `grub-mkfont` creates a PF2 file, so the source font must be converted
|
||||
for each size used by the theme. The bundled themes use the DejaVu Sans files
|
||||
from `common/DejaVuSans.ttf`; Unifont is also included for broad Unicode
|
||||
coverage.
|
||||
|
||||
To regenerate the bundled fonts, run:
|
||||
```sh
|
||||
cd common
|
||||
./makefont.sh
|
||||
```
|
||||
|
||||
The script supports both command names used by Linux distributions:
|
||||
`grub-mkfont` (including NixOS) and `grub2-mkfont` (including Fedora and
|
||||
openSUSE). To convert another font, pass its path, an output prefix, and
|
||||
optional sizes:
|
||||
```sh
|
||||
./makefont.sh /path/to/MyFont.ttf my-font 16 24 32
|
||||
```
|
||||
|
||||
## Contributing:
|
||||
- If you made changes to icons, or added a new one:
|
||||
- Delete the existing icon, if there is one
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+52
-4
@@ -1,5 +1,53 @@
|
||||
#! /usr/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
grub2-mkfont -o unifont-16.pf2 -s 16 unifont.otf
|
||||
grub2-mkfont -o unifont-24.pf2 -s 24 unifont.otf
|
||||
grub2-mkfont -o unifont-32.pf2 -s 32 unifont.otf
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SCRIPT_DIR
|
||||
|
||||
if [[ -n "${GRUB_MKFONT:-}" ]]; then
|
||||
readonly FONT_TOOL="${GRUB_MKFONT}"
|
||||
elif command -v grub-mkfont >/dev/null 2>&1; then
|
||||
readonly FONT_TOOL="grub-mkfont"
|
||||
elif command -v grub2-mkfont >/dev/null 2>&1; then
|
||||
readonly FONT_TOOL="grub2-mkfont"
|
||||
else
|
||||
printf 'error: grub-mkfont or grub2-mkfont is required\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
generate_font() {
|
||||
local font_file="$1"
|
||||
local output_prefix="$2"
|
||||
shift 2
|
||||
|
||||
for size in "$@"; do
|
||||
"${FONT_TOOL}" \
|
||||
--output "${SCRIPT_DIR}/${output_prefix}-${size}.pf2" \
|
||||
--size "${size}" \
|
||||
"${font_file}"
|
||||
done
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf 'Usage: %s [FONT_FILE OUTPUT_PREFIX [SIZE ...]]\n' "$(basename "$0")" >&2
|
||||
printf 'Without arguments, regenerate the bundled DejaVu Sans and Unifont files.\n' >&2
|
||||
}
|
||||
|
||||
if (( $# == 0 )); then
|
||||
generate_font "${SCRIPT_DIR}/DejaVuSans.ttf" dejavu_sans 12 14 16 24 32 48
|
||||
generate_font "${SCRIPT_DIR}/unifont.otf" unifont 16 24 32
|
||||
elif (( $# >= 2 )); then
|
||||
font_file="$1"
|
||||
output_prefix="$2"
|
||||
shift 2
|
||||
if (( $# == 0 )); then
|
||||
set -- 16 24 32
|
||||
fi
|
||||
generate_font "${font_file}" "${output_prefix}" "$@"
|
||||
else
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@@ -19,7 +19,7 @@ terminal-border: "0"
|
||||
top = 30%
|
||||
width = 40%
|
||||
height = 40%
|
||||
item_font = "Unifont Regular 16"
|
||||
item_font = "DejaVu Sans Regular 16"
|
||||
item_color = "#cccccc"
|
||||
selected_item_color = "#ffffff"
|
||||
icon_width = 32
|
||||
@@ -48,5 +48,5 @@ terminal-border: "0"
|
||||
id = "__timeout__"
|
||||
text = "Booting in %d seconds"
|
||||
color = "#cccccc"
|
||||
font = "Unifont Regular 16"
|
||||
font = "DejaVu Sans Regular 16"
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ terminal-border: "0"
|
||||
top = 30%
|
||||
width = 40%
|
||||
height = 40%
|
||||
item_font = "Unifont Regular 24"
|
||||
item_font = "DejaVu Sans Regular 24"
|
||||
item_color = "#cccccc"
|
||||
selected_item_color = "#ffffff"
|
||||
icon_width = 48
|
||||
@@ -48,5 +48,5 @@ terminal-border: "0"
|
||||
id = "__timeout__"
|
||||
text = "Booting in %d seconds"
|
||||
color = "#cccccc"
|
||||
font = "Unifont Regular 24"
|
||||
font = "DejaVu Sans Regular 24"
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ terminal-border: "0"
|
||||
top = 30%
|
||||
width = 40%
|
||||
height = 40%
|
||||
item_font = "Unifont Regular 32"
|
||||
item_font = "DejaVu Sans Regular 32"
|
||||
item_color = "#cccccc"
|
||||
selected_item_color = "#ffffff"
|
||||
icon_width = 64
|
||||
@@ -48,5 +48,5 @@ terminal-border: "0"
|
||||
id = "__timeout__"
|
||||
text = "Booting in %d seconds"
|
||||
color = "#cccccc"
|
||||
font = "Unifont Regular 32"
|
||||
font = "DejaVu Sans Regular 32"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ terminal-border: "0"
|
||||
top = 30%
|
||||
width = 40%
|
||||
height = 40%
|
||||
item_font = "Unifont Regular 16"
|
||||
item_font = "DejaVu Sans Regular 16"
|
||||
item_color = "#cccccc"
|
||||
selected_item_color = "#ffffff"
|
||||
icon_width = 32
|
||||
@@ -48,5 +48,5 @@ terminal-border: "0"
|
||||
id = "__timeout__"
|
||||
text = "Booting in %d seconds"
|
||||
color = "#cccccc"
|
||||
font = "Unifont Regular 16"
|
||||
font = "DejaVu Sans Regular 16"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ terminal-border: "0"
|
||||
top = 30%
|
||||
width = 40%
|
||||
height = 40%
|
||||
item_font = "Unifont Regular 24"
|
||||
item_font = "DejaVu Sans Regular 24"
|
||||
item_color = "#cccccc"
|
||||
selected_item_color = "#ffffff"
|
||||
icon_width = 48
|
||||
@@ -48,5 +48,5 @@ terminal-border: "0"
|
||||
id = "__timeout__"
|
||||
text = "Booting in %d seconds"
|
||||
color = "#cccccc"
|
||||
font = "Unifont Regular 24"
|
||||
font = "DejaVu Sans Regular 24"
|
||||
}
|
||||
|
||||
+9
-2
@@ -1,5 +1,12 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Define which command to use for ImageMagick
|
||||
if command -v magick &> /dev/null; then
|
||||
_MAGICK="magick"
|
||||
else
|
||||
_MAGICK="convert"
|
||||
fi
|
||||
|
||||
# Exit Immediately if a command fails
|
||||
set -o errexit
|
||||
|
||||
@@ -127,7 +134,7 @@ generate() {
|
||||
sed -i "s/[0-9]\+x[0-9]\+/${custom_resolution}/" "${THEME_DIR}/${theme}/theme.txt"
|
||||
# Use appropriate background as base and resize it
|
||||
cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${asset_type}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg"
|
||||
magick "${THEME_DIR}/${theme}/background.jpg" -resize ${custom_resolution}^ -gravity center -extent ${custom_resolution} "${THEME_DIR}/${theme}/background.jpg"
|
||||
"${_MAGICK}" "${THEME_DIR}/${theme}/background.jpg" -resize ${custom_resolution}^ -gravity center -extent ${custom_resolution} "${THEME_DIR}/${theme}/background.jpg"
|
||||
else
|
||||
cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${screen}.txt" "${THEME_DIR}/${theme}/theme.txt"
|
||||
cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${screen}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg"
|
||||
@@ -142,7 +149,7 @@ generate() {
|
||||
fi
|
||||
prompt -w "\n Using custom background.jpg as grub background image..."
|
||||
cp -a --no-preserve=ownership "${REO_DIR}/background.jpg" "${THEME_DIR}/${theme}/background.jpg"
|
||||
magick "${THEME_DIR}/${theme}/background.jpg" -auto-orient "${THEME_DIR}/${theme}/background.jpg"
|
||||
"${_MAGICK}" "${THEME_DIR}/${theme}/background.jpg" -auto-orient "${THEME_DIR}/${theme}/background.jpg"
|
||||
fi
|
||||
|
||||
# Determine which assets to use based on custom resolution or screen
|
||||
|
||||
Reference in New Issue
Block a user