diff --git a/modules/kmscon.nix b/modules/kmscon.nix index 98dac55..4c859bd 100644 --- a/modules/kmscon.nix +++ b/modules/kmscon.nix @@ -4,6 +4,7 @@ lib, ... }: let + # generate shell command options for kmscon fom an attrset generateOptions = with builtins; ( opts: toString ( @@ -12,10 +13,12 @@ ) ) ); + # generate a hexadecimal number lookup table to get integers from them hexLookupTable = with lib; (listToAttrs (genList (i: { name = let r = toHexString i; in ( + # pad with 0 in front if only 1 digit if (stringLength r) == 1 then "0${r}" else r @@ -23,6 +26,7 @@ value = toString i; }) 256)); + # "parse" hex color strings and convert them to kmscon options hexToOpt = with lib; (color: concatStringsSep "," [ (getAttr (substring 1 2 (toUpper color)) hexLookupTable)