Add a highlight background color

Adds an IBInspectable background color for the hightlight state.
This commit is contained in:
Jonathan Bennett 2019-10-28 00:51:13 -04:00
parent 47ca7a8a30
commit 25411ead45

View File

@ -10,6 +10,8 @@ import UIKit
class VibrantButton: UIButton { class VibrantButton: UIButton {
@IBInspectable var backgroundHighlightColor: UIColor = AppAssets.secondaryAccentColor
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
commonInit() commonInit()
@ -25,7 +27,7 @@ class VibrantButton: UIButton {
override var isHighlighted: Bool { override var isHighlighted: Bool {
didSet { didSet {
backgroundColor = isHighlighted ? AppAssets.secondaryAccentColor : nil backgroundColor = isHighlighted ? backgroundHighlightColor : nil
titleLabel?.alpha = 1 titleLabel?.alpha = 1
} }
} }