Dark mode appearance tweaks

This commit is contained in:
James Magahern
2022-02-21 15:52:18 -08:00
parent c8b4242bc6
commit 224a39b64f
3 changed files with 16 additions and 27 deletions

View File

@@ -80,38 +80,28 @@ class ReliefButton: UIButton
}
static func gradientColors(inverted: Bool, darkMode: Bool) -> [UIColor] {
if darkMode {
if !inverted {
let colors = { darkMode -> [UIColor] in
if darkMode {
return [
UIColor(white: 0.20, alpha: 1.0),
UIColor(white: 0.10, alpha: 1.0)
UIColor(white: 0.15, alpha: 1.0),
UIColor(white: 0.08, alpha: 1.0)
]
} else {
return [
UIColor(white: 0.10, alpha: 1.0),
UIColor(white: 0.30, alpha: 1.0)
]
}
} else {
if !inverted {
return [
UIColor(white: 0.98, alpha: 1.0),
UIColor(white: 0.93, alpha: 1.0)
]
} else {
return [
UIColor(white: 0.88, alpha: 1.0),
UIColor(white: 0.93, alpha: 1.0)
]
}
}
} (darkMode)
return inverted ? colors.reversed() : colors
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
setBackgroundInverted(isHighlighted)
backgroundView.layer.borderColor = { traitCollection -> UIColor in
if traitCollection.userInterfaceStyle == .dark {
return .init(white: 0.34, alpha: 1.0)
return .init(white: 0.30, alpha: 1.0)
} else {
return .white
}