added selected Icon Color Configuration

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-04-18 14:18:40 -05:00
parent a8e1f96d9b
commit 7eddaf1d04

View File

@ -138,6 +138,8 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
/// Icon Name used within the Icon within the Selected State.
open var selectedIconName: Icon.Name? { didSet { setNeedsUpdate() } }
open var selectedIconColorConfiguration: SurfaceColorConfiguration? { didSet { setNeedsUpdate() } }
/// Sets the size of button icon and icon.
open var size: Size = .large { didSet { setNeedsUpdate() } }
@ -180,12 +182,16 @@ open class ButtonIcon: Control, Changeable, FormFieldable {
// MARK: - Configuration
//--------------------------------------------------
private var iconColorConfiguration: AnyColorable {
if kind == .highContrast {
return highContrastIconColorConfiguration
} else if kind == .lowContrast {
return (surfaceType == .colorFill) ? lowContrastIconColorConfiguration : (floating ? lowContrastIconColorConfiguration : standardIconColorConfiguration)
if let selectedIconColorConfiguration, isSelected {
return selectedIconColorConfiguration.eraseToAnyColorable()
} else {
return standardIconColorConfiguration
if kind == .highContrast {
return highContrastIconColorConfiguration
} else if kind == .lowContrast {
return (surfaceType == .colorFill) ? lowContrastIconColorConfiguration : (floating ? lowContrastIconColorConfiguration : standardIconColorConfiguration)
} else {
return standardIconColorConfiguration
}
}
}