chore: use systemBackground color

This commit is contained in:
sunxiaojian 2021-04-16 22:58:36 +08:00
parent bc588e08db
commit 780025a3ce
6 changed files with 15 additions and 59 deletions

View File

@ -44,7 +44,6 @@ internal enum Asset {
internal static let mediaTypeIndicotor = ColorAsset(name: "Colors/Background/media.type.indicotor") internal static let mediaTypeIndicotor = ColorAsset(name: "Colors/Background/media.type.indicotor")
internal static let navigationBar = ColorAsset(name: "Colors/Background/navigationBar") internal static let navigationBar = ColorAsset(name: "Colors/Background/navigationBar")
internal static let onboardingBackground = ColorAsset(name: "Colors/Background/onboarding.background") internal static let onboardingBackground = ColorAsset(name: "Colors/Background/onboarding.background")
internal static let pure = ColorAsset(name: "Colors/Background/pure")
internal static let secondaryGroupedSystemBackground = ColorAsset(name: "Colors/Background/secondary.grouped.system.background") internal static let secondaryGroupedSystemBackground = ColorAsset(name: "Colors/Background/secondary.grouped.system.background")
internal static let secondarySystemBackground = ColorAsset(name: "Colors/Background/secondary.system.background") internal static let secondarySystemBackground = ColorAsset(name: "Colors/Background/secondary.system.background")
internal static let systemBackground = ColorAsset(name: "Colors/Background/system.background") internal static let systemBackground = ColorAsset(name: "Colors/Background/system.background")

View File

@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "30",
"green" : "28",
"red" : "28"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -45,7 +45,7 @@ final class NotificationViewController: UIViewController, NeedsDependency {
extension NotificationViewController { extension NotificationViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Asset.Colors.Background.pure.color view.backgroundColor = Asset.Colors.Background.systemBackground.color
navigationItem.titleView = segmentControl navigationItem.titleView = segmentControl
segmentControl.addTarget(self, action: #selector(NotificationViewController.segmentedControlValueChanged(_:)), for: .valueChanged) segmentControl.addTarget(self, action: #selector(NotificationViewController.segmentedControlValueChanged(_:)), for: .valueChanged)
view.addSubview(tableView) view.addSubview(tableView)

View File

@ -26,7 +26,7 @@ final class NotificationStatusTableViewCell: UITableViewCell {
let actionImageView: UIImageView = { let actionImageView: UIImageView = {
let imageView = UIImageView() let imageView = UIImageView()
imageView.tintColor = Asset.Colors.Background.pure.color imageView.tintColor = Asset.Colors.Background.systemBackground.color
return imageView return imageView
}() }()
@ -36,8 +36,8 @@ final class NotificationStatusTableViewCell: UITableViewCell {
view.layer.cornerCurve = .continuous view.layer.cornerCurve = .continuous
view.clipsToBounds = true view.clipsToBounds = true
view.layer.borderWidth = NotificationStatusTableViewCell.actionImageBorderWidth view.layer.borderWidth = NotificationStatusTableViewCell.actionImageBorderWidth
view.layer.borderColor = Asset.Colors.Background.pure.color.cgColor view.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor
view.tintColor = Asset.Colors.Background.pure.color view.tintColor = Asset.Colors.Background.systemBackground.color
return view return view
}() }()
@ -157,7 +157,7 @@ extension NotificationStatusTableViewCell {
let actionStackView = UIStackView() let actionStackView = UIStackView()
actionStackView.axis = .horizontal actionStackView.axis = .horizontal
actionStackView.distribution = .fillProportionally actionStackView.distribution = .fill
actionStackView.spacing = 4 actionStackView.spacing = 4
actionStackView.translatesAutoresizingMaskIntoConstraints = false actionStackView.translatesAutoresizingMaskIntoConstraints = false
@ -166,7 +166,8 @@ extension NotificationStatusTableViewCell {
actionLabel.translatesAutoresizingMaskIntoConstraints = false actionLabel.translatesAutoresizingMaskIntoConstraints = false
actionStackView.addArrangedSubview(actionLabel) actionStackView.addArrangedSubview(actionLabel)
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical) nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
nameLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
let statusStackView = UIStackView() let statusStackView = UIStackView()
statusStackView.axis = .vertical statusStackView.axis = .vertical
@ -205,6 +206,6 @@ extension NotificationStatusTableViewCell {
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)
statusBorder.layer.borderColor = Asset.Colors.Border.notification.color.cgColor statusBorder.layer.borderColor = Asset.Colors.Border.notification.color.cgColor
actionImageBackground.layer.borderColor = Asset.Colors.Background.pure.color.cgColor actionImageBackground.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor
} }
} }

View File

@ -35,7 +35,7 @@ final class NotificationTableViewCell: UITableViewCell {
let actionImageView: UIImageView = { let actionImageView: UIImageView = {
let imageView = UIImageView() let imageView = UIImageView()
imageView.tintColor = Asset.Colors.Background.pure.color imageView.tintColor = Asset.Colors.Background.systemBackground.color
return imageView return imageView
}() }()
@ -45,8 +45,8 @@ final class NotificationTableViewCell: UITableViewCell {
view.layer.cornerCurve = .continuous view.layer.cornerCurve = .continuous
view.clipsToBounds = true view.clipsToBounds = true
view.layer.borderWidth = NotificationTableViewCell.actionImageBorderWidth view.layer.borderWidth = NotificationTableViewCell.actionImageBorderWidth
view.layer.borderColor = Asset.Colors.Background.pure.color.cgColor view.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor
view.tintColor = Asset.Colors.Background.pure.color view.tintColor = Asset.Colors.Background.systemBackground.color
return view return view
}() }()
@ -138,24 +138,18 @@ extension NotificationTableViewCell {
actionImageView.centerYAnchor.constraint(equalTo: actionImageBackground.centerYAnchor) actionImageView.centerYAnchor.constraint(equalTo: actionImageBackground.centerYAnchor)
]) ])
let actionStackView = UIStackView()
actionStackView.axis = .horizontal
actionStackView.distribution = .fillProportionally
actionStackView.spacing = 4
actionStackView.translatesAutoresizingMaskIntoConstraints = false
nameLabel.translatesAutoresizingMaskIntoConstraints = false nameLabel.translatesAutoresizingMaskIntoConstraints = false
containerStackView.addArrangedSubview(nameLabel) containerStackView.addArrangedSubview(nameLabel)
actionLabel.translatesAutoresizingMaskIntoConstraints = false actionLabel.translatesAutoresizingMaskIntoConstraints = false
containerStackView.addArrangedSubview(actionLabel) containerStackView.addArrangedSubview(actionLabel)
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical) nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
containerStackView.addArrangedSubview(actionStackView) nameLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
} }
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)
actionImageBackground.layer.borderColor = Asset.Colors.Background.pure.color.cgColor actionImageBackground.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor
} }
} }

View File

@ -82,7 +82,7 @@ final class SearchViewController: UIViewController, NeedsDependency {
// searching // searching
let searchingTableView: UITableView = { let searchingTableView: UITableView = {
let tableView = UITableView() let tableView = UITableView()
tableView.backgroundColor = Asset.Colors.Background.pure.color tableView.backgroundColor = Asset.Colors.Background.systemBackground.color
tableView.rowHeight = UITableView.automaticDimension tableView.rowHeight = UITableView.automaticDimension
tableView.separatorStyle = .singleLine tableView.separatorStyle = .singleLine
tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)