nixos-icons: recolor white logo (#297)

Fixes #292
This commit is contained in:
Daniel Thwaites 2024-03-23 20:02:10 +00:00 committed by GitHub
parent 4da2d793e5
commit 53d3e5d5b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,24 @@
{ pkgs, config, lib, ... }:
with config.lib.stylix.colors;
{
options.stylix.targets.nixos-icons.enable =
config.lib.stylix.mkEnableTarget "the NixOS logo" true;
config.nixpkgs.overlays = lib.mkIf config.stylix.targets.nixos-icons.enable [(self: super: {
nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: {
patchPhase = ''
substituteInPlace logo/white.svg --replace-fail '#ffffff' '#${base05}'
# Insert attribution comment after the XML prolog
sed \
--in-place \
'2i<!-- The original NixOS logo from ${oldAttrs.src.url} is licensed under https://creativecommons.org/licenses/by/4.0 and has been modified to match the ${scheme} color scheme. -->' \
logo/white.svg
${lib.getExe pkgs.resvg} logo/white.svg logo/white.png
'';
});
})];
}