From 2da23eca312306c4141aa7da27d91678302e87c1 Mon Sep 17 00:00:00 2001 From: SparklesReal Date: Wed, 9 Jul 2025 20:47:28 +0200 Subject: [PATCH] Fixes for if 'colorScheme' is auto --- packages/map/components/Markers/StationMarker.tsx | 3 +-- packages/map/components/Markers/TrainMarker.tsx | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/map/components/Markers/StationMarker.tsx b/packages/map/components/Markers/StationMarker.tsx index c732b84..858c9d1 100644 --- a/packages/map/components/Markers/StationMarker.tsx +++ b/packages/map/components/Markers/StationMarker.tsx @@ -38,9 +38,8 @@ export const StationMarker = ({ station }: StationMarkerProps) => { const { colorScheme } = useMantineColorScheme(); let botIcon = "/markers/icon-bot-simrail.jpg"; - if (colorScheme === "dark") + if (colorScheme === "dark" || colorScheme === "auto" && window.matchMedia('(prefers-color-scheme: dark)').matches) botIcon = "/markers/icon-bot-simrail-dark.jpg"; - // window.matchMedia('(prefers-color-scheme: dark)').matches incase colorScheme === auto we need to see what the system uses const icon = L.icon({ iconUrl: station.DispatchedBy[0] && avatar ? avatar : botIcon, diff --git a/packages/map/components/Markers/TrainMarker.tsx b/packages/map/components/Markers/TrainMarker.tsx index 0e5df86..f7d49e7 100644 --- a/packages/map/components/Markers/TrainMarker.tsx +++ b/packages/map/components/Markers/TrainMarker.tsx @@ -33,10 +33,10 @@ const TrainMarker = ({ train }: TrainMarkerProps) => { const { colorScheme } = useMantineColorScheme(); + let botIcon = "/markers/icon-bot-simrail.jpg"; - if (colorScheme === "dark") + if (colorScheme === "dark" || colorScheme === "auto" && window.matchMedia('(prefers-color-scheme: dark)').matches) botIcon = "/markers/icon-bot-simrail-dark.jpg"; - // window.matchMedia('(prefers-color-scheme: dark)').matches incase colorScheme === auto we need to see what the system uses const icon = L.icon({ iconUrl: train.TrainData.ControlledBySteamID && avatar ? avatar : botIcon,