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
fastfetchConfig = builtins.fromJSON (builtins.readFile ./config.json);
cfg = config.liminalOS.shellEnv.fastfetch;
@ -19,21 +25,39 @@ in
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 {
enable = true;
settings = (
fastfetchConfig
// {
logo = {
height = 18;
padding = {
top = 2;
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;
settings = (
fastfetchConfig
// {
logo = {
height = 18;
padding = {
top = 2;
};
type = if cfg.useKittyImage then "kitty" else "auto";
source = lib.mkIf cfg.useKittyImage image;
};
type = if cfg.useKittyImage then "kitty" else "auto";
source = lib.mkIf cfg.useKittyImage ./nixos-logo.png;
};
}
);
};
}
);
};
}