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;
};
style.label = lib.mkOption {
type = lib.types.nullOr
(lib.types.strMatching "[0-9A-Z]");
default = null;
style = {
label = lib.mkOption {
type = lib.types.nullOr
(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
{
options = {
@ -54,6 +76,10 @@ in
ganondorf.departure = {
location = "Argentinia";
style = {
color = "green";
};
};
};
@ -83,6 +109,7 @@ in
lib.optional (marker.style.label != null)
"label:${marker.style.label}"
++ [
"color:${marker.style.color}"
"$(${config.scripts.geocode}/bin/geocode ${
lib.escapeShellArg marker.location
})"