From 53e3544effa012d36f3b0d732a922ca219b7692a Mon Sep 17 00:00:00 2001
From: memdmp <memdmp@estrogen.zone>
Date: Sat, 23 Aug 2025 19:34:47 +0200
Subject: feat: changes

---
 src/lib/assets/LineGlyph.svelte | 44 ++++++++++++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 14 deletions(-)

(limited to 'src/lib/assets/LineGlyph.svelte')

diff --git a/src/lib/assets/LineGlyph.svelte b/src/lib/assets/LineGlyph.svelte
index a92716e..d890438 100644
--- a/src/lib/assets/LineGlyph.svelte
+++ b/src/lib/assets/LineGlyph.svelte
@@ -96,20 +96,34 @@
     },
   };
   let {
-    kind: routeShortName,
+    kind: _routeShortName,
     type: _type,
     line: _line,
     currentColor: _currentColor,
-    nightIsFilled = true,
+    forceColor,
+    dark = false,
+    negative = true,
   }: {
     /** i.e. RE69, TER, etc...  */
     kind: string;
     type?: keyof typeof fernverkehrIconMap | string | null;
     line?: string;
-    nightIsFilled?: boolean;
-  } & {
-    currentColor?: string;
-  } = $props();
+    negative?: boolean;
+    dark?: boolean;
+  } & (
+    | {
+        currentColor: string;
+        forceColor?: boolean;
+      }
+    | Record<string, never>
+  ) = $props();
+  let routeShortName = $derived(
+    _routeShortName.startsWith('REX ')
+      ? _routeShortName.length >= 7
+        ? 'REX'
+        : _routeShortName.replace('REX ', 'REX')
+      : _routeShortName
+  );
 
   let shortNumberIndex = $derived(
     routeShortName.split('').findIndex((char) => char.match(/[0-9]/))
@@ -150,13 +164,15 @@
     isFernverkehr = $derived(
       (lineType ?? '').toUpperCase() in fernverkehrIconMap
     ),
-    isNightRendering =
+    isNightRendering = $derived(
       routeShortName.toUpperCase().startsWith('SN') ||
-      routeShortName.toUpperCase().startsWith('REN') ||
-      routeShortName.toUpperCase().startsWith('IRN'),
-    isErsatzverkehr = routeShortName.toUpperCase().startsWith('EV');
+        routeShortName.toUpperCase().startsWith('REN') ||
+        routeShortName.toUpperCase().startsWith('IRN')
+    ),
+    isErsatzverkehr = $derived(routeShortName.toUpperCase().startsWith('EV'));
   let currentColor = $derived(
-    _currentColor ?? (isRE ? '#eb0000' : 'currentColor')
+    (forceColor || !(isRE && !dark) ? _currentColor : undefined) ??
+      (isRE && !dark ? '#eb0000' : 'currentColor')
   );
   const sbbFontFamilySvgDeclaration =
     "font-family: SBB, 'SBB Web', 'Helvetica Neue', Helvetica, Inter, system-ui, sans-serif";
@@ -258,12 +274,12 @@
         id="path1-8"
         style="display:inline;fill:{isErsatzverkehr
           ? '#e84e10'
-          : nightIsFilled && isNightRendering
+          : negative && isNightRendering
             ? '#000'
             : 'none'};stroke:{isErsatzverkehr
           ? '#e84e10'
           : isNightRendering
-            ? nightIsFilled
+            ? negative
               ? '#000'
               : '#FFDE15'
             : currentColor};stroke-opacity:1"
@@ -301,7 +317,7 @@
           'fill-opacity:1',
           `stroke:${
             /*isNightRendering
-          ? nightIsFilled
+          ? negative
             '#FFDE15'
           : currentColor*/ 'none'
           }`,
-- 
cgit v1.2.3

