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) ")"]; }