fix(plymouth): recolor splash art from the palette for contrast
The shipped boot art was a fixed navy that vanished against dark theme bases. Recolor each element from theme-state.json at build time (flat fill, alpha preserved): foreground glyphs (logo, padlock, password dots) → text, the field/track boxes (entry, progress_box) → surface, and the progress fill → accent. text/surface both contrast with base in either polarity, so the splash now reads on light and dark themes alike. Adds imagemagick as a build-time input to the theme derivation. Like the background tint, this follows the theme as of the last system rebuild. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,16 @@ let
|
|||||||
if cfg.stateFile != null
|
if cfg.stateFile != null
|
||||||
then builtins.fromJSON (builtins.readFile cfg.stateFile)
|
then builtins.fromJSON (builtins.readFile cfg.stateFile)
|
||||||
else { };
|
else { };
|
||||||
base = lib.removePrefix "#" ((state.colors or { }).base or "#1a1b26");
|
colorOf = key: fallback: lib.removePrefix "#" ((state.colors or { }).${key} or fallback);
|
||||||
|
base = colorOf "base" "#1a1b26";
|
||||||
|
# Splash elements are recolored from the palette so they read on any
|
||||||
|
# base, light or dark: foreground glyphs → text, field/track boxes →
|
||||||
|
# surface (raised from base in both polarities), the progress fill →
|
||||||
|
# accent. The shipped art is a fixed navy that vanished on dark themes.
|
||||||
|
text = colorOf "text" "#a9b1d6";
|
||||||
|
surface = colorOf "surface" "#32344a";
|
||||||
|
accent = colorOf "accent" "#7aa2f7";
|
||||||
|
magick = lib.getExe' pkgs.imagemagick "magick";
|
||||||
|
|
||||||
# Plymouth's Window.SetBackgroundTopColor takes three floats in
|
# Plymouth's Window.SetBackgroundTopColor takes three floats in
|
||||||
# 0.0–1.0; the .plymouth metadata's ConsoleLogBackgroundColor takes a
|
# 0.0–1.0; the .plymouth metadata's ConsoleLogBackgroundColor takes a
|
||||||
@@ -36,13 +45,26 @@ let
|
|||||||
|
|
||||||
src = ./plymouth;
|
src = ./plymouth;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgs.imagemagick ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share/plymouth/themes/nomarchy
|
themedir=$out/share/plymouth/themes/nomarchy
|
||||||
cp * $out/share/plymouth/themes/nomarchy/
|
mkdir -p "$themedir"
|
||||||
|
cp * "$themedir/"
|
||||||
|
|
||||||
|
# Recolor the splash art from the palette (flat fill, alpha kept) so
|
||||||
|
# it reads on any base instead of the shipped fixed navy.
|
||||||
|
recolor() { ${magick} "$themedir/$1" -fill "#$2" -colorize 100 "$themedir/$1"; }
|
||||||
|
recolor logo.png ${text} # centre monogram
|
||||||
|
recolor lock.png ${text} # password-prompt padlock
|
||||||
|
recolor bullet.png ${text} # password dots
|
||||||
|
recolor entry.png ${surface} # password field box
|
||||||
|
recolor progress_box.png ${surface} # progress track
|
||||||
|
recolor progress_bar.png ${accent} # progress fill
|
||||||
|
|
||||||
# Point the .plymouth metadata into the store
|
# Point the .plymouth metadata into the store
|
||||||
sed -i "s|/usr/share/plymouth/themes/nomarchy|$out/share/plymouth/themes/nomarchy|g" \
|
sed -i "s|/usr/share/plymouth/themes/nomarchy|$themedir|g" \
|
||||||
$out/share/plymouth/themes/nomarchy/nomarchy.plymouth
|
"$themedir/nomarchy.plymouth"
|
||||||
|
|
||||||
# Bake the theme's base color: RGB floats for the script's
|
# Bake the theme's base color: RGB floats for the script's
|
||||||
# Window.SetBackground* calls, 0xRRGGBB for ConsoleLogBackground.
|
# Window.SetBackground* calls, 0xRRGGBB for ConsoleLogBackground.
|
||||||
@@ -50,9 +72,9 @@ let
|
|||||||
-e 's|@BG_R@|${channel 0}|g' \
|
-e 's|@BG_R@|${channel 0}|g' \
|
||||||
-e 's|@BG_G@|${channel 2}|g' \
|
-e 's|@BG_G@|${channel 2}|g' \
|
||||||
-e 's|@BG_B@|${channel 4}|g' \
|
-e 's|@BG_B@|${channel 4}|g' \
|
||||||
$out/share/plymouth/themes/nomarchy/nomarchy.script
|
"$themedir/nomarchy.script"
|
||||||
sed -i 's|@BG_HEX@|${base}|g' \
|
sed -i 's|@BG_HEX@|${base}|g' \
|
||||||
$out/share/plymouth/themes/nomarchy/nomarchy.plymouth
|
"$themedir/nomarchy.plymouth"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
Reference in New Issue
Block a user