From 418be1ed632ab4f63a39a5c7d0cbe271dece789b Mon Sep 17 00:00:00 2001 From: KoenDR06 Date: Wed, 24 Dec 2025 18:08:58 +0100 Subject: [PATCH] fix: leftPad to hex --- overlays/catppuccin.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/overlays/catppuccin.nix b/overlays/catppuccin.nix index 5980626..4bc397a 100644 --- a/overlays/catppuccin.nix +++ b/overlays/catppuccin.nix @@ -1,8 +1,11 @@ {inputs, ...}: let - inherit (inputs.nixpkgs.lib) toHexString concatStrings; + inherit (inputs.nixpkgs.lib) toHexString concatStrings strings; + inherit (strings) fixedWidthString; + + padHex = n: fixedWidthString 2 "0" (toHexString n); in { - toHex = color: concatStrings ["#" (toHexString color.red) (toHexString color.green) (toHexString color.blue)]; - toHexNoHash = color: concatStrings [(toHexString color.red) (toHexString color.green) (toHexString color.blue)]; + toHex = color: concatStrings ["#" (padHex color.red) (padHex color.green) (padHex color.blue)]; + toHexNoHash = color: concatStrings [(padHex color.red) (padHex color.green) (padHex color.blue)]; toRGB = color: concatStrings ["rgb(" (toString color.red) "," (toString color.green) "," (toString color.blue) ")"]; toRGBA = color: a: concatStrings ["rgba(" (toString color.red) "," (toString color.green) "," (toString color.blue) "," (toString a) ")"]; }