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 navigationBar = ColorAsset(name: "Colors/Background/navigationBar")
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 secondarySystemBackground = ColorAsset(name: "Colors/Background/secondary.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 {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = Asset.Colors.Background.pure.color
view.backgroundColor = Asset.Colors.Background.systemBackground.color
navigationItem.titleView = segmentControl
segmentControl.addTarget(self, action: #selector(NotificationViewController.segmentedControlValueChanged(_:)), for: .valueChanged)
view.addSubview(tableView)

View File

@ -26,7 +26,7 @@ final class NotificationStatusTableViewCell: UITableViewCell {
let actionImageView: UIImageView = {
let imageView = UIImageView()
imageView.tintColor = Asset.Colors.Background.pure.color
imageView.tintColor = Asset.Colors.Background.systemBackground.color
return imageView
}()
@ -36,8 +36,8 @@ final class NotificationStatusTableViewCell: UITableViewCell {
view.layer.cornerCurve = .continuous
view.clipsToBounds = true
view.layer.borderWidth = NotificationStatusTableViewCell.actionImageBorderWidth
view.layer.borderColor = Asset.Colors.Background.pure.color.cgColor
view.tintColor = Asset.Colors.Background.pure.color
view.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor
view.tintColor = Asset.Colors.Background.systemBackground.color
return view
}()
@ -157,7 +157,7 @@ extension NotificationStatusTableViewCell {
let actionStackView = UIStackView()
actionStackView.axis = .horizontal
actionStackView.distribution = .fillProportionally
actionStackView.distribution = .fill
actionStackView.spacing = 4
actionStackView.translatesAutoresizingMaskIntoConstraints = false
@ -166,7 +166,8 @@ extension NotificationStatusTableViewCell {
actionLabel.translatesAutoresizingMaskIntoConstraints = false
actionStackView.addArrangedSubview(actionLabel)
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
nameLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
let statusStackView = UIStackView()
statusStackView.axis = .vertical
@ -205,6 +206,6 @@ extension NotificationStatusTableViewCell {
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
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 imageView = UIImageView()
imageView.tintColor = Asset.Colors.Background.pure.color
imageView.tintColor = Asset.Colors.Background.systemBackground.color
return imageView
}()
@ -45,8 +45,8 @@ final class NotificationTableViewCell: UITableViewCell {
view.layer.cornerCurve = .continuous
view.clipsToBounds = true
view.layer.borderWidth = NotificationTableViewCell.actionImageBorderWidth
view.layer.borderColor = Asset.Colors.Background.pure.color.cgColor
view.tintColor = Asset.Colors.Background.pure.color
view.layer.borderColor = Asset.Colors.Background.systemBackground.color.cgColor
view.tintColor = Asset.Colors.Background.systemBackground.color
return view
}()
@ -137,25 +137,19 @@ extension NotificationTableViewCell {
actionImageView.centerXAnchor.constraint(equalTo: actionImageBackground.centerXAnchor),
actionImageView.centerYAnchor.constraint(equalTo: actionImageBackground.centerYAnchor)
])
let actionStackView = UIStackView()
actionStackView.axis = .horizontal
actionStackView.distribution = .fillProportionally
actionStackView.spacing = 4
actionStackView.translatesAutoresizingMaskIntoConstraints = false
nameLabel.translatesAutoresizingMaskIntoConstraints = false
containerStackView.addArrangedSubview(nameLabel)
actionLabel.translatesAutoresizingMaskIntoConstraints = false
containerStackView.addArrangedSubview(actionLabel)
nameLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical)
containerStackView.addArrangedSubview(actionStackView)
nameLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
actionLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
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
let searchingTableView: UITableView = {
let tableView = UITableView()
tableView.backgroundColor = Asset.Colors.Background.pure.color
tableView.backgroundColor = Asset.Colors.Background.systemBackground.color
tableView.rowHeight = UITableView.automaticDimension
tableView.separatorStyle = .singleLine
tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)