From 4caca606a328b520adb701b10fd6d9cf779cab4a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 28 Apr 2024 18:21:30 +0200 Subject: [PATCH] Allow setting the color of pins --- marker.nix | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/marker.nix b/marker.nix index f604539..3f1964f 100644 --- a/marker.nix +++ b/marker.nix @@ -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 })"