From 0a64c8163445e27f5123fdcf083fb3a5449b5c49 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 20 Jun 2026 03:43:08 +0800
Subject: [PATCH] Fix dark Space hover readability

---
 C1.source/Sources/Aligner/QuickSwitchRootView.swift |   50 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index f137091..81e6310 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -4454,17 +4454,41 @@
             )
             : nil
 
-        applySpaceLaneContentVisualState(segment, isLocked: isLocked)
+        applySpaceLaneContentVisualState(
+            segment,
+            isLocked: isLocked,
+            usesLightActiveFill: resolvedTheme == .dark && hasWindows && !isLocked && (isActive || isAssociated)
+        )
     }
 
-    private func applySpaceLaneContentVisualState(_ segment: SpaceLaneSegmentLayers, isLocked: Bool) {
-        let primaryTextColor: NSColor = isLocked ? .white : themePalette.spaceLanePrimaryText
+    private func applySpaceLaneContentVisualState(
+        _ segment: SpaceLaneSegmentLayers,
+        isLocked: Bool,
+        usesLightActiveFill: Bool
+    ) {
+        let primaryTextColor: NSColor = isLocked
+            ? .white
+            : usesLightActiveFill
+                ? NSColor.black.withAlphaComponent(0.82)
+                : themePalette.spaceLanePrimaryText
         let secondaryTextColor: NSColor = isLocked
             ? .white
-            : themePalette.spaceLaneSecondaryText
+            : usesLightActiveFill
+                ? NSColor.black.withAlphaComponent(0.58)
+                : themePalette.spaceLaneSecondaryText
+        let markerTextColor: NSColor = isLocked
+            ? .white
+            : usesLightActiveFill
+                ? NSColor.black.withAlphaComponent(0.62)
+                : themePalette.spaceLaneSecondaryText.withAlphaComponent(segment.space.isCurrent ? 0.72 : 0.54)
+        let blockColor: NSColor = isLocked
+            ? .white
+            : usesLightActiveFill
+                ? NSColor.black.withAlphaComponent(0.20)
+                : spaceLaneOccupiedColor.withAlphaComponent(segment.space.isCurrent ? 0.72 : 0.58)
 
         segment.labelLayer.foregroundColor = primaryTextColor.cgColor
-        segment.countLayer.foregroundColor = (isLocked ? NSColor.white : themePalette.spaceLaneSecondaryText).cgColor
+        segment.countLayer.foregroundColor = secondaryTextColor.cgColor
         segment.appLayer.foregroundColor = (segment.space.type == .fullscreen
             ? primaryTextColor
             : secondaryTextColor
@@ -4474,16 +4498,10 @@
         }
 
         for block in segment.windowBlocks {
-            block.backgroundColor = (isLocked
-                ? NSColor.white
-                : spaceLaneOccupiedColor.withAlphaComponent(segment.space.isCurrent ? 0.72 : 0.58)
-            ).cgColor
+            block.backgroundColor = blockColor.cgColor
         }
 
-        (segment.fullscreenMarkerLayer as? CAShapeLayer)?.strokeColor = (isLocked
-            ? NSColor.white
-            : themePalette.spaceLaneSecondaryText.withAlphaComponent(segment.space.isCurrent ? 0.72 : 0.54)
-        ).cgColor
+        (segment.fullscreenMarkerLayer as? CAShapeLayer)?.strokeColor = markerTextColor.cgColor
     }
 
     private func shouldScrollSpaceLane(for event: NSEvent) -> Bool {
@@ -7035,6 +7053,10 @@
                 }
                 let isAppAssociated = appHoverAssociatedSpaceIDs.contains(space.id)
                 let isWindowAssociated = space.id == windowHoverAssociatedSpaceID
+                let isLocked = space.id == currentViewModel?.lockedSpaceID
+                let isActive = space.id == activeSpaceFocusID || isLocked
+                let isAssociated = (isAppAssociated || isWindowAssociated) && !isActive
+                let usesLightActiveFill = resolvedTheme == .dark && space.windowCount > 0 && !isLocked && (isActive || isAssociated)
                 let group = spaceLaneDisplayGroup(containingSpaceID: space.id)
                 let visibleFrame = segment.containerLayer.frame.offsetBy(
                     dx: (group?.containerLayer.frame.minX ?? 0) + spaceLaneContentLayer.frame.minX,
@@ -7053,6 +7075,8 @@
                     "label": space.label,
                     "type": spaceTypeName(space.type),
                     "visualStates": visualStates(for: space),
+                    "usesLightActiveFill": usesLightActiveFill,
+                    "foregroundContrastStyle": usesLightActiveFill ? "darkOnLight" : "themeDefault",
                     "fullscreenMarkerVisible": segment.fullscreenMarkerLayer != nil,
                     "fullscreenMarkerKind": fullscreenMarkerKind(
                         markerLayer: segment.fullscreenMarkerLayer,

--
Gitblit v1.9.3