forked from zelo72/mastodon-ios
fix: pick server scene Dark Mode
This commit is contained in:
parent
078c89adc7
commit
00794a259a
|
@ -34,7 +34,7 @@ extension CategoryPickerSection {
|
||||||
cell.categoryView.titleLabel.textColor = .white
|
cell.categoryView.titleLabel.textColor = .white
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cell.categoryView.bgView.backgroundColor = Asset.Colors.Background.systemBackground.color
|
cell.categoryView.bgView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
||||||
cell.categoryView.bgView.applyShadow(color: Asset.Colors.brandBlue.color, alpha: 0, x: 0, y: 0, blur: 0.0)
|
cell.categoryView.bgView.applyShadow(color: Asset.Colors.brandBlue.color, alpha: 0, x: 0, y: 0, blur: 0.0)
|
||||||
if case .all = item {
|
if case .all = item {
|
||||||
cell.categoryView.titleLabel.textColor = Asset.Colors.brandBlue.color
|
cell.categoryView.titleLabel.textColor = Asset.Colors.brandBlue.color
|
||||||
|
|
|
@ -84,6 +84,7 @@ internal enum Asset {
|
||||||
internal static let bar = ColorAsset(name: "Colors/Slider/bar")
|
internal static let bar = ColorAsset(name: "Colors/Slider/bar")
|
||||||
}
|
}
|
||||||
internal enum TextField {
|
internal enum TextField {
|
||||||
|
internal static let background = ColorAsset(name: "Colors/TextField/background")
|
||||||
internal static let highlight = ColorAsset(name: "Colors/TextField/highlight")
|
internal static let highlight = ColorAsset(name: "Colors/TextField/highlight")
|
||||||
internal static let invalid = ColorAsset(name: "Colors/TextField/invalid")
|
internal static let invalid = ColorAsset(name: "Colors/TextField/invalid")
|
||||||
internal static let valid = ColorAsset(name: "Colors/TextField/valid")
|
internal static let valid = ColorAsset(name: "Colors/TextField/valid")
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "0.600",
|
||||||
|
"blue" : "213",
|
||||||
|
"green" : "212",
|
||||||
|
"red" : "212"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "0.240",
|
||||||
|
"blue" : "128",
|
||||||
|
"green" : "118",
|
||||||
|
"red" : "118"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ class PickServerCell: UITableViewCell {
|
||||||
let containerView: UIView = {
|
let containerView: UIView = {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16)
|
view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16)
|
||||||
view.backgroundColor = Asset.Colors.Background.systemBackground.color
|
view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -17,7 +17,7 @@ class PickServerSearchCell: UITableViewCell {
|
||||||
|
|
||||||
private var bgView: UIView = {
|
private var bgView: UIView = {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
view.backgroundColor = Asset.Colors.Background.systemBackground.color
|
view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.layer.maskedCorners = [
|
view.layer.maskedCorners = [
|
||||||
.layerMinXMinYCorner,
|
.layerMinXMinYCorner,
|
||||||
|
@ -30,7 +30,7 @@ class PickServerSearchCell: UITableViewCell {
|
||||||
|
|
||||||
private var textFieldBgView: UIView = {
|
private var textFieldBgView: UIView = {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
view.backgroundColor = Asset.Colors.Background.secondarySystemBackground.color.withAlphaComponent(0.6)
|
view.backgroundColor = Asset.Colors.TextField.background.color
|
||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.layer.masksToBounds = true
|
view.layer.masksToBounds = true
|
||||||
view.layer.cornerRadius = 6
|
view.layer.cornerRadius = 6
|
||||||
|
|
|
@ -48,7 +48,7 @@ extension PickServerCategoryView {
|
||||||
addSubview(bgView)
|
addSubview(bgView)
|
||||||
addSubview(titleLabel)
|
addSubview(titleLabel)
|
||||||
|
|
||||||
bgView.backgroundColor = Asset.Colors.Background.systemBackground.color
|
bgView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
bgView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
|
bgView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
|
||||||
|
|
|
@ -20,8 +20,7 @@ extension OnboardingViewControllerAppearance {
|
||||||
static var viewBottomPaddingHeight: CGFloat { return 11 }
|
static var viewBottomPaddingHeight: CGFloat { return 11 }
|
||||||
|
|
||||||
func setupOnboardingAppearance() {
|
func setupOnboardingAppearance() {
|
||||||
overrideUserInterfaceStyle = .light
|
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
|
||||||
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color
|
|
||||||
|
|
||||||
setupNavigationBarAppearance()
|
setupNavigationBarAppearance()
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ extension OnboardingViewControllerAppearance {
|
||||||
func setupNavigationBarBackgroundView() {
|
func setupNavigationBarBackgroundView() {
|
||||||
let navigationBarBackgroundView: UIView = {
|
let navigationBarBackgroundView: UIView = {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color
|
view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,8 @@ extension PrimaryActionButton {
|
||||||
private func _init() {
|
private func _init() {
|
||||||
titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold))
|
titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold))
|
||||||
setTitleColor(.white, for: .normal)
|
setTitleColor(.white, for: .normal)
|
||||||
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.normal.color), for: .normal)
|
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color), for: .normal)
|
||||||
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.normal.color.withAlphaComponent(0.5)), for: .highlighted)
|
setupButtonBackground()
|
||||||
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.disabled.color), for: .disabled)
|
|
||||||
applyCornerRadius(radius: 10)
|
applyCornerRadius(radius: 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,4 +67,21 @@ extension PrimaryActionButton {
|
||||||
isEnabled = true
|
isEnabled = true
|
||||||
self.setTitle(originalButtonTitle, for: .disabled)
|
self.setTitle(originalButtonTitle, for: .disabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||||
|
setupButtonBackground()
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupButtonBackground() {
|
||||||
|
if UIScreen.main.traitCollection.userInterfaceStyle == .light {
|
||||||
|
setTitleColor(.white, for: .disabled)
|
||||||
|
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.normal.color.withAlphaComponent(0.5)), for: .highlighted)
|
||||||
|
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.disabled.color), for: .disabled)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
setTitleColor(UIColor.white.withAlphaComponent(0.5), for: .disabled)
|
||||||
|
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color.withAlphaComponent(0.5)), for: .highlighted)
|
||||||
|
setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color.withAlphaComponent(0.5)), for: .disabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue