feat: tint the fastfetch image with system colors for consistency

This commit is contained in:
Youwen Wu 2025-05-27 01:03:45 -07:00
parent 19812d4514
commit 3c3d13f3a9

View file

@ -1,4 +1,10 @@
{ config, lib, ... }: {
config,
lib,
osConfig,
pkgs,
...
}:
let let
fastfetchConfig = builtins.fromJSON (builtins.readFile ./config.json); fastfetchConfig = builtins.fromJSON (builtins.readFile ./config.json);
cfg = config.liminalOS.shellEnv.fastfetch; cfg = config.liminalOS.shellEnv.fastfetch;
@ -19,8 +25,26 @@ in
Whether to use the kitty image protocol. Whether to use the kitty image protocol.
''; '';
}; };
tintImage = lib.mkOption {
type = lib.types.bool;
default = osConfig.liminalOS.theming.enable;
description = ''
Whether to tint the image with system wide colors.
'';
}; };
config.programs.fastfetch = lib.mkIf cfg.enable { };
config.programs.fastfetch =
let
image =
if !cfg.tintImage then
./nixos-logo.png
else
pkgs.runCommand "nixos-logo.png" { } ''
COLOR="#${config.lib.stylix.colors.base0A}"
${lib.getExe pkgs.imagemagick} ${./nixos-logo.png} -size 512x512 -fill $COLOR -tint 50 $out
'';
in
lib.mkIf cfg.enable {
enable = true; enable = true;
settings = ( settings = (
fastfetchConfig fastfetchConfig
@ -31,7 +55,7 @@ in
top = 2; top = 2;
}; };
type = if cfg.useKittyImage then "kitty" else "auto"; type = if cfg.useKittyImage then "kitty" else "auto";
source = lib.mkIf cfg.useKittyImage ./nixos-logo.png; source = lib.mkIf cfg.useKittyImage image;
}; };
} }
); );