Skip to content

[#437] Fix color of default loading button in high contrast light mode #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Change color of indicator and borders in high contrast mode (light scheme) for radio and checkbox components (#645)
- Change color of button loader in high contrast light mode (#437)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ struct ButtonBorderModifier: ViewModifier {
@Environment(\.theme) private var theme
@Environment(\.oudsUseMonochrome) private var useMonochrome
@Environment(\.oudsOnColoredSurface) private var onColoredSurface
@Environment(\.colorScheme) private var colorScheme
@Environment(\.colorSchemeContrast) private var colorSchemeContrast

// MARK: Stored Properties

Expand Down Expand Up @@ -88,7 +90,11 @@ struct ButtonBorderModifier: ViewModifier {
case .pressed:
useMonochrome ? theme.button.buttonColorBorderDefaultPressedMono : theme.button.buttonColorBorderDefaultPressed
case .loading:
useMonochrome ? theme.button.buttonColorBorderDefaultLoadingMono : theme.button.buttonColorBorderDefaultLoading
if colorSchemeContrast == .increased, colorScheme == .light {
theme.colors.colorContentDefault
} else {
useMonochrome ? theme.button.buttonColorBorderDefaultLoadingMono : theme.button.buttonColorBorderDefaultLoading
}
case .disabled:
useMonochrome ? theme.button.buttonColorBorderDefaultDisabledMono : theme.button.buttonColorBorderDefaultDisabled
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import SwiftUI
/// Used to add a progress indicator instead of content (Text, Icon)
/// As the button must keep the size of the content, the indicator is
/// added as overlay on top, and the content is hidden applying an opacity.
/// If the device has the high contrast mode enabled, changes the loader color.
struct ButtonLoadingContentModifier: ViewModifier {

@Environment(\.theme) private var theme
@Environment(\.colorScheme) private var colorScheme
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
@Environment(\.oudsUseMonochrome) private var useMonochrome

// MARK: Stored Properties
Expand All @@ -46,7 +48,11 @@ struct ButtonLoadingContentModifier: ViewModifier {
private var colorToken: MultipleColorSemanticTokens {
switch hierarchy {
case .default:
useMonochrome ? theme.button.buttonColorContentDefaultLoadingMono : theme.button.buttonColorContentDefaultLoading
if colorSchemeContrast == .increased, colorScheme == .light {
theme.colors.colorContentDefault
} else {
useMonochrome ? theme.button.buttonColorContentDefaultLoadingMono : theme.button.buttonColorContentDefaultLoading
}
case .strong:
useMonochrome ? theme.button.buttonColorContentStrongLoadingMono : theme.colors.colorContentOnActionLoading
case .minimal:
Expand Down