Fix tvOS controls overlay button text legibility

Improved text contrast on overlay buttons by:
- Applying foreground color directly to button labels to ensure proper override
- Using semi-transparent gray background for unfocused buttons instead of Color.secondary
- Removing accent color overrides from caption text to respect button styling

This ensures readable text in both focused (black on white) and unfocused
(white on gray) states.
This commit is contained in:
Arkadiusz Fal
2025-11-22 23:40:23 +01:00
parent 997de6468d
commit 0913c6d73c
2 changed files with 4 additions and 6 deletions

View File

@@ -24,6 +24,7 @@ struct ControlsOverlayButton<LabelView: View>: View {
if let onSelect {
Button(action: onSelect) {
label
.foregroundColor(isFocused ? .black : .white)
.padding()
.frame(width: 400)
}
@@ -31,12 +32,12 @@ struct ControlsOverlayButton<LabelView: View>: View {
.focused(focusedField, equals: field)
} else {
label
.foregroundColor(isFocused ? .black : .white)
.padding()
.frame(width: 400)
.focusable()
.focused(focusedField, equals: field)
.background(isFocused ? Color.white : Color.secondary)
.foregroundColor(isFocused ? Color.black : Color.white)
.background(isFocused ? Color.white : Color.gray.opacity(0.5))
.clipShape(RoundedRectangle(cornerRadius: 4))
}
}
@@ -47,8 +48,7 @@ struct TVButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.background(isFocused ? Color.white : Color.secondary)
.foregroundColor(isFocused ? Color.black : Color.white)
.background(isFocused ? Color.white : Color.gray.opacity(0.5))
.clipShape(RoundedRectangle(cornerRadius: 4))
.scaleEffect(configuration.isPressed ? 0.95 : 1.0)
}