diff --git a/Segmentio/Source/Cells/SegmentioCell.swift b/Segmentio/Source/Cells/SegmentioCell.swift index 43d0cd0..d859ec1 100644 --- a/Segmentio/Source/Cells/SegmentioCell.swift +++ b/Segmentio/Source/Cells/SegmentioCell.swift @@ -148,6 +148,7 @@ class SegmentioCell: UICollectionViewCell { if (style != .onlyLabel) { segmentImageView?.image = selected ? selectedImage : image + segmentImageView?.tintColor = selected ? selectedState.imageTintColor : defaultState.imageTintColor } } diff --git a/Segmentio/Source/SegmentioOptions.swift b/Segmentio/Source/SegmentioOptions.swift index c711ede..57b7c12 100644 --- a/Segmentio/Source/SegmentioOptions.swift +++ b/Segmentio/Source/SegmentioOptions.swift @@ -50,15 +50,18 @@ public struct SegmentioState { var titleFont: UIFont var titleTextColor: UIColor var titleAlpha: CGFloat + var imageTintColor: UIColor public init( backgroundColor: UIColor = .clear, titleFont: UIFont = UIFont.systemFont(ofSize: UIFont.smallSystemFontSize), titleTextColor: UIColor = .black, + imageTintColor: UIColor? = nil, titleAlpha: CGFloat = 1) { self.backgroundColor = backgroundColor self.titleFont = titleFont self.titleTextColor = titleTextColor + self.imageTintColor = imageTintColor ?? titleTextColor self.titleAlpha = titleAlpha }