nvf/lib/types/theme.nix
2024-09-29 23:22:26 +02:00

13 lines
392 B
Nix

{lib}: let
inherit (lib.strings) isString hasPrefix;
inherit (lib.types) mkOptionType;
inherit (builtins) stringLength;
# This was almost entirely taken from raf himself.
in {
hexColorType = mkOptionType {
name = "hex-color";
descriptionClass = "noun";
description = "RGB color in hex format";
check = x: isString x && hasPrefix "#" x && stringLength x == 7;
};
}