mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 20:38:47 +00:00
14 lines
392 B
Nix
14 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;
|
||
|
};
|
||
|
}
|