pushed out fix for using surface color config

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-05-22 08:45:31 -05:00
parent 3bc2b18962
commit dc4db4816d

View File

@ -56,10 +56,12 @@ open class Icon: View {
if let hex = color.hexString, !UIColor.isVDSColor(color: color) {
print("icon.color is not a VDSColor. Hex: \(hex) is not a supported color")
}
setNeedsUpdate()
colorConfiguration = SurfaceColorConfiguration(color, color)
}
}
open var colorConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark) { didSet { setNeedsUpdate() } }
/// Size of the icon.
open var size: Size = .medium { didSet { setNeedsUpdate() } }
@ -98,15 +100,8 @@ open class Icon: View {
open override func updateView() {
super.updateView()
//get the color for the image
var imageColor = color
//ensure the correct color for white/black colors
if surface == .dark && color == VDSColor.paletteBlack {
imageColor = VDSColor.elementsPrimaryOndark
} else if surface == .light && color == VDSColor.paletteBlack {
imageColor = VDSColor.elementsPrimaryOnlight
}
let imageColor = colorConfiguration.getColor(surface)
//get the image name
//set the image
if let name, let image = UIImage.image(for: name, color: imageColor) {