Skip to content

Commit 5e985c6

Browse files
committed
fix: default loading button on high contrast light mode (#437) (#708)
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
1 parent 0ddc2b5 commit 5e985c6

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Fixed
1414

15-
- Change color of indicator and borders in high contrast mode (light scheme) for radio and checkbox components (#645)
15+
- Change color of indicator and borders in high contrast mode (light scheme) for radio and checkbox components (Orange-OpenSource/ouds-ios##645)
16+
- Change color of button loader in high contrast light mode (Orange-OpenSource/ouds-ios#437)
1617

1718
## [0.15.0](https://github.com/Orange-OpenSource/ouds-ios/compare/0.14.0...0.15.0) - 2025-05-28
1819

OUDS/Core/Components/Sources/Buttons/Internal/ButtonStyle+BorderModifier.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ struct ButtonBorderModifier: ViewModifier {
2222
@Environment(\.theme) private var theme
2323
@Environment(\.oudsUseMonochrome) private var useMonochrome
2424
@Environment(\.oudsOnColoredSurface) private var onColoredSurface
25+
@Environment(\.colorScheme) private var colorScheme
26+
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
2527

2628
// MARK: Stored Properties
2729

@@ -88,7 +90,11 @@ struct ButtonBorderModifier: ViewModifier {
8890
case .pressed:
8991
useMonochrome ? theme.button.buttonColorBorderDefaultPressedMono : theme.button.buttonColorBorderDefaultPressed
9092
case .loading:
91-
useMonochrome ? theme.button.buttonColorBorderDefaultLoadingMono : theme.button.buttonColorBorderDefaultLoading
93+
if colorSchemeContrast == .increased, colorScheme == .light {
94+
theme.colors.colorContentDefault
95+
} else {
96+
useMonochrome ? theme.button.buttonColorBorderDefaultLoadingMono : theme.button.buttonColorBorderDefaultLoading
97+
}
9298
case .disabled:
9399
useMonochrome ? theme.button.buttonColorBorderDefaultDisabledMono : theme.button.buttonColorBorderDefaultDisabled
94100
}

OUDS/Core/Components/Sources/Buttons/Internal/ButtonStyle+LoadingModifiers.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ import SwiftUI
2121
/// Used to add a progress indicator instead of content (Text, Icon)
2222
/// As the button must keep the size of the content, the indicator is
2323
/// added as overlay on top, and the content is hidden applying an opacity.
24+
/// If the device has the high contrast mode enabled, changes the loader color.
2425
struct ButtonLoadingContentModifier: ViewModifier {
2526

2627
@Environment(\.theme) private var theme
2728
@Environment(\.colorScheme) private var colorScheme
29+
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
2830
@Environment(\.oudsUseMonochrome) private var useMonochrome
2931

3032
// MARK: Stored Properties
@@ -46,7 +48,11 @@ struct ButtonLoadingContentModifier: ViewModifier {
4648
private var colorToken: MultipleColorSemanticTokens {
4749
switch hierarchy {
4850
case .default:
49-
useMonochrome ? theme.button.buttonColorContentDefaultLoadingMono : theme.button.buttonColorContentDefaultLoading
51+
if colorSchemeContrast == .increased, colorScheme == .light {
52+
theme.colors.colorContentDefault
53+
} else {
54+
useMonochrome ? theme.button.buttonColorContentDefaultLoadingMono : theme.button.buttonColorContentDefaultLoading
55+
}
5056
case .strong:
5157
useMonochrome ? theme.button.buttonColorContentStrongLoadingMono : theme.colors.colorContentOnActionLoading
5258
case .minimal:

0 commit comments

Comments
 (0)