We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ba06fd commit b2f694cCopy full SHA for b2f694c
lib/types/theme.nix
@@ -1,13 +1,14 @@
1
{lib}: let
2
- inherit (lib.strings) isString hasPrefix;
+ inherit (lib.strings) isString;
3
inherit (lib.types) mkOptionType;
4
- inherit (builtins) stringLength;
+ inherit (builtins) match;
5
# This was almost entirely taken from raf himself.
6
in {
7
hexColorType = mkOptionType {
8
name = "hex-color";
9
descriptionClass = "noun";
10
description = "RGB color in hex format";
11
- check = x: isString x && hasPrefix "#" x && stringLength x == 7;
+ # Check to determine wether the provided color is base16-valid
12
+ check = x: isString x && (match "#[0-9a-fA-F]{6}" x) != null;
13
};
14
}
0 commit comments