From 3c3d13f3a9a21afabefd794995bb8e99c55fd01a Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 27 May 2025 01:03:45 -0700 Subject: [PATCH] feat: tint the fastfetch image with system colors for consistency --- .../common/shellenv/fastfetch/default.nix | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/hm/modules/common/shellenv/fastfetch/default.nix b/hm/modules/common/shellenv/fastfetch/default.nix index a7fc792..3ecdf20 100644 --- a/hm/modules/common/shellenv/fastfetch/default.nix +++ b/hm/modules/common/shellenv/fastfetch/default.nix @@ -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; - }; - } - ); - }; + } + ); + }; }