mirror of
https://github.com/danth/stylix
synced 2024-11-23 04:33:15 +00:00
Allow using theme colours for Plymouth ✨
There is now a choice to either follow the main theme or keep a black background. systemd-boot enables the black background by default, as it always has a black background itself, and keeping the same colour throughout the whole boot process looks cleaner than applying our theme at the first opportunity.
This commit is contained in:
parent
ee248692cb
commit
1d61691bf9
2 changed files with 27 additions and 2 deletions
|
@ -18,6 +18,13 @@ let
|
||||||
cp ${config.lib.stylix.pixel "base01"} $themeDir/progress-bar.png
|
cp ${config.lib.stylix.pixel "base01"} $themeDir/progress-bar.png
|
||||||
|
|
||||||
cp ${./theme.script} $themeDir/stylix.script
|
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 "
|
echo "
|
||||||
[Plymouth Theme]
|
[Plymouth Theme]
|
||||||
|
@ -48,6 +55,18 @@ in {
|
||||||
sha256 = "SCuQlSPB14GFTq4XvExJ0QEuK2VIbrd5YYKHLRG/q5I=";
|
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 "<literal>true</literal> if systemd-boot is enabled";
|
||||||
|
default = config.boot.loader.systemd-boot.enable;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.boot.plymouth = mkIf config.stylix.targets.plymouth.enable {
|
config.boot.plymouth = mkIf config.stylix.targets.plymouth.enable {
|
||||||
|
|
|
@ -3,6 +3,12 @@ center_y = Window.GetHeight() / 2;
|
||||||
baseline_y = (Window.GetHeight() / 3) * 2;
|
baseline_y = (Window.GetHeight() / 3) * 2;
|
||||||
|
|
||||||
|
|
||||||
|
### BACKGROUND ###
|
||||||
|
|
||||||
|
Window.SetBackgroundTopColor(%BASE00%);
|
||||||
|
Window.SetBackgroundBottomColor(%BASE00%);
|
||||||
|
|
||||||
|
|
||||||
### LOGO ###
|
### LOGO ###
|
||||||
|
|
||||||
logo.original_image = Image("logo.png");
|
logo.original_image = Image("logo.png");
|
||||||
|
@ -60,13 +66,13 @@ Plymouth.SetBootProgressFunction(progress_callback);
|
||||||
|
|
||||||
prompt = null;
|
prompt = null;
|
||||||
bullets = null;
|
bullets = null;
|
||||||
bullet.image = Image.Text("•", 1, 1, 1);
|
bullet.image = Image.Text("•", %BASE05%);
|
||||||
|
|
||||||
fun password_callback (prompt_text, bullet_count) {
|
fun password_callback (prompt_text, bullet_count) {
|
||||||
progress_background.sprite.SetOpacity(0);
|
progress_background.sprite.SetOpacity(0);
|
||||||
progress_bar.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 = Sprite(prompt.image);
|
||||||
prompt.sprite.SetPosition(
|
prompt.sprite.SetPosition(
|
||||||
center_x - (prompt.image.GetWidth() / 2),
|
center_x - (prompt.image.GetWidth() / 2),
|
||||||
|
|
Loading…
Reference in a new issue