diff --git a/modules/plymouth/default.nix b/modules/plymouth/default.nix index 69edaef..4156f8d 100644 --- a/modules/plymouth/default.nix +++ b/modules/plymouth/default.nix @@ -18,6 +18,13 @@ let cp ${config.lib.stylix.pixel "base01"} $themeDir/progress-bar.png cp ${./theme.script} $themeDir/stylix.script + substituteInPlace $themeDir/stylix.script \ + --replace "%BASE00%" "${ + if config.stylix.targets.plymouth.blackBackground + then "0, 0, 0" + else "${base00-dec-r}, ${base00-dec-g}, ${base00-dec-b}" + }" \ + --replace "%BASE05%" "${base05-dec-r}, ${base05-dec-g}, ${base05-dec-b}" echo " [Plymouth Theme] @@ -48,6 +55,18 @@ in { sha256 = "SCuQlSPB14GFTq4XvExJ0QEuK2VIbrd5YYKHLRG/q5I="; }; }; + + blackBackground = mkOption { + description = '' + Whether to use a black background rather than a theme colour. + + This looks good in combination with systemd-boot, as it means that the + background colour doesn't change throughout the boot process. + ''; + type = types.bool; + defaultText = literalDocBook "true if systemd-boot is enabled"; + default = config.boot.loader.systemd-boot.enable; + }; }; config.boot.plymouth = mkIf config.stylix.targets.plymouth.enable { diff --git a/modules/plymouth/theme.script b/modules/plymouth/theme.script index 820df2d..c50de95 100644 --- a/modules/plymouth/theme.script +++ b/modules/plymouth/theme.script @@ -3,6 +3,12 @@ center_y = Window.GetHeight() / 2; baseline_y = (Window.GetHeight() / 3) * 2; +### BACKGROUND ### + +Window.SetBackgroundTopColor(%BASE00%); +Window.SetBackgroundBottomColor(%BASE00%); + + ### LOGO ### logo.original_image = Image("logo.png"); @@ -60,13 +66,13 @@ Plymouth.SetBootProgressFunction(progress_callback); prompt = null; bullets = null; -bullet.image = Image.Text("•", 1, 1, 1); +bullet.image = Image.Text("•", %BASE05%); fun password_callback (prompt_text, bullet_count) { progress_background.sprite.SetOpacity(0); progress_bar.sprite.SetOpacity(0); - prompt.image = Image.Text("Enter password", 1, 1, 1); + prompt.image = Image.Text("Enter password", %BASE05%); prompt.sprite = Sprite(prompt.image); prompt.sprite.SetPosition( center_x - (prompt.image.GetWidth() / 2),