Allow colouring paths

This commit is contained in:
Manuel Thalmann 2024-04-28 22:00:44 +02:00
parent a8a685ccf3
commit 3237fe5d84
2 changed files with 24 additions and 1 deletions

View file

@ -98,11 +98,12 @@ in
}; };
arrival = { arrival = {
location = "Prague"; location = "Chile";
}; };
pathStyle = { pathStyle = {
weight = 10; weight = 10;
color = "purple";
}; };
}; };

View file

@ -19,8 +19,29 @@ let
type = lib.types.ints.between 1 20; type = lib.types.ints.between 1 20;
default = 5; default = 5;
}; };
color = lib.mkOption {
type = colorType;
default = "blue";
}; };
}; };
};
colorType = lib.types.either
(lib.types.strMatching "0x[0-9A-F]{3}([0-9A-F]([0-9A-F]{2}([0-9A-F]{2})?)?)?")
(
lib.types.enum [
"black"
"blue"
"brown"
"gray"
"green"
"orange"
"purple"
"red"
"white"
"yellow"
]);
in in
{ {
options = { options = {
@ -64,6 +85,7 @@ in
attributes = attributes =
[ [
"weight:${toString path.style.weight}" "weight:${toString path.style.weight}"
"color:${path.style.color}"
] ]
++ builtins.map attrForLocation path.locations; ++ builtins.map attrForLocation path.locations;
in in