fix: should help with colors getting stuck

This commit is contained in:
Michael Freno
2026-01-14 11:36:14 -05:00
parent 23000589cf
commit 205a889a38
2 changed files with 15 additions and 6 deletions

View File

@@ -11,7 +11,8 @@ extension View {
@ViewBuilder @ViewBuilder
func glassEffectIfAvailable<S: InsettableShape>( func glassEffectIfAvailable<S: InsettableShape>(
_ style: GlassStyle, _ style: GlassStyle,
in shape: S in shape: S,
colorScheme: ColorScheme? = nil
) -> some View { ) -> some View {
if #available(macOS 26.0, *) { if #available(macOS 26.0, *) {
self.glassEffect(style.toGlass(), in: shape) self.glassEffect(style.toGlass(), in: shape)
@@ -40,6 +41,7 @@ extension View {
} }
} }
.shadow(color: .black.opacity(0.1), radius: 4, x: 0, y: 2) .shadow(color: .black.opacity(0.1), radius: 4, x: 0, y: 2)
.id(colorScheme)
} }
} }
} }

View File

@@ -46,6 +46,7 @@ struct MenuBarButtonStyle: ButtonStyle {
} }
struct MenuBarHoverButtonStyle: ButtonStyle { struct MenuBarHoverButtonStyle: ButtonStyle {
@Environment(\.colorScheme) private var colorScheme
@State private var isHovered = false @State private var isHovered = false
func makeBody(configuration: Configuration) -> some View { func makeBody(configuration: Configuration) -> some View {
@@ -55,7 +56,8 @@ struct MenuBarHoverButtonStyle: ButtonStyle {
isHovered isHovered
? GlassStyle.regular.tint(.accentColor).interactive() ? GlassStyle.regular.tint(.accentColor).interactive()
: GlassStyle.regular, : GlassStyle.regular,
in: .rect(cornerRadius: 6) in: .rect(cornerRadius: 6),
colorScheme: colorScheme
) )
.contentShape(Rectangle()) .contentShape(Rectangle())
.onHover { hovering in .onHover { hovering in
@@ -318,6 +320,7 @@ struct TimerStatusRowWithIndividualControls: View {
var onDevTrigger: (() -> Void)? = nil var onDevTrigger: (() -> Void)? = nil
var onTogglePause: (Bool) -> Void var onTogglePause: (Bool) -> Void
var onTap: (() -> Void)? = nil var onTap: (() -> Void)? = nil
@Environment(\.colorScheme) private var colorScheme
@State private var isHoveredSkip = false @State private var isHoveredSkip = false
@State private var isHoveredDevTrigger = false @State private var isHoveredDevTrigger = false
@State private var isHoveredBody = false @State private var isHoveredBody = false
@@ -433,7 +436,8 @@ struct TimerStatusRowWithIndividualControls: View {
.glassEffectIfAvailable( .glassEffectIfAvailable(
isHoveredDevTrigger isHoveredDevTrigger
? GlassStyle.regular.tint(.yellow) : GlassStyle.regular, ? GlassStyle.regular.tint(.yellow) : GlassStyle.regular,
in: .circle in: .circle,
colorScheme: colorScheme
) )
.help("Trigger \(displayName) reminder now (dev)") .help("Trigger \(displayName) reminder now (dev)")
.accessibilityIdentifier("trigger_\(displayName.replacingOccurrences(of: " ", with: "_"))") .accessibilityIdentifier("trigger_\(displayName.replacingOccurrences(of: " ", with: "_"))")
@@ -459,7 +463,8 @@ struct TimerStatusRowWithIndividualControls: View {
.glassEffectIfAvailable( .glassEffectIfAvailable(
isHoveredPauseButton isHoveredPauseButton
? GlassStyle.regular.tint(.accentColor) : GlassStyle.regular, ? GlassStyle.regular.tint(.accentColor) : GlassStyle.regular,
in: .circle in: .circle,
colorScheme: colorScheme
) )
.help( .help(
isPaused isPaused
@@ -480,7 +485,8 @@ struct TimerStatusRowWithIndividualControls: View {
.glassEffectIfAvailable( .glassEffectIfAvailable(
isHoveredSkip isHoveredSkip
? GlassStyle.regular.tint(.accentColor) : GlassStyle.regular, ? GlassStyle.regular.tint(.accentColor) : GlassStyle.regular,
in: .circle in: .circle,
colorScheme: colorScheme
) )
.help("Skip to next \(displayName) reminder") .help("Skip to next \(displayName) reminder")
.onHover { hovering in .onHover { hovering in
@@ -493,7 +499,8 @@ struct TimerStatusRowWithIndividualControls: View {
isHoveredBody isHoveredBody
? GlassStyle.regular.tint(.accentColor) ? GlassStyle.regular.tint(.accentColor)
: GlassStyle.regular, : GlassStyle.regular,
in: .rect(cornerRadius: 6) in: .rect(cornerRadius: 6),
colorScheme: colorScheme
) )
.padding(.horizontal, 8) .padding(.horizontal, 8)
.onHover { hovering in .onHover { hovering in