Allow setting the color of pins

This commit is contained in:
Manuel Thalmann 2024-04-28 18:21:30 +02:00
parent 6c134d9878
commit 4caca606a3

View file

@ -27,13 +27,35 @@ let
default = null; default = null;
}; };
style.label = lib.mkOption { style = {
type = lib.types.nullOr label = lib.mkOption {
(lib.types.strMatching "[0-9A-Z]"); type = lib.types.nullOr
default = null; (lib.types.strMatching "[0-9A-Z]");
default = null;
};
color = lib.mkOption {
type = colorType;
default = "red";
};
}; };
}; };
}; };
colorType = lib.types.either
(lib.types.strMatching "0x[0-9A-F]{3}[0-9A-F]{3}?")
(lib.types.enum [
"black"
"blue"
"brown"
"gray"
"green"
"orange"
"purple"
"red"
"white"
"yellow"
]);
in in
{ {
options = { options = {
@ -54,6 +76,10 @@ in
ganondorf.departure = { ganondorf.departure = {
location = "Argentinia"; location = "Argentinia";
style = {
color = "green";
};
}; };
}; };
@ -83,6 +109,7 @@ in
lib.optional (marker.style.label != null) lib.optional (marker.style.label != null)
"label:${marker.style.label}" "label:${marker.style.label}"
++ [ ++ [
"color:${marker.style.color}"
"$(${config.scripts.geocode}/bin/geocode ${ "$(${config.scripts.geocode}/bin/geocode ${
lib.escapeShellArg marker.location lib.escapeShellArg marker.location
})" })"