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 = {
location = "Prague";
location = "Chile";
};
pathStyle = {
weight = 10;
color = "purple";
};
};

View file

@ -19,8 +19,29 @@ let
type = lib.types.ints.between 1 20;
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
{
options = {
@ -64,6 +85,7 @@ in
attributes =
[
"weight:${toString path.style.weight}"
"color:${path.style.color}"
]
++ builtins.map attrForLocation path.locations;
in