chore: update cell highlighted color for Dark Mode

This commit is contained in:
CMK 2021-07-02 13:21:05 +08:00
parent d2be2a3918
commit f4a2792b0f
18 changed files with 148 additions and 25 deletions

View File

@ -12,7 +12,7 @@
<key>CoreDataStack.xcscheme_^#shared#^_</key> <key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>20</integer> <integer>21</integer>
</dict> </dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key> <key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict> <dict>
@ -37,7 +37,7 @@
<key>NotificationService.xcscheme_^#shared#^_</key> <key>NotificationService.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>21</integer> <integer>20</integer>
</dict> </dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>

View File

@ -279,7 +279,10 @@ private extension SceneCoordinator {
scheme == "http" || scheme == "https" else { scheme == "http" || scheme == "https" else {
return nil return nil
} }
viewController = SFSafariViewController(url: url) let _viewController = SFSafariViewController(url: url)
_viewController.preferredControlTintColor = Asset.Colors.brandBlue.color
viewController = _viewController
case .alertController(let alertController): case .alertController(let alertController):
if let popoverPresentationController = alertController.popoverPresentationController { if let popoverPresentationController = alertController.popoverPresentationController {
assert( assert(

View File

@ -67,13 +67,13 @@ extension PollSection {
cell.pollOptionView.checkmarkBackgroundView.isHidden = true cell.pollOptionView.checkmarkBackgroundView.isHidden = true
cell.pollOptionView.checkmarkImageView.isHidden = true cell.pollOptionView.checkmarkImageView.isHidden = true
case .off: case .off:
cell.pollOptionView.checkmarkBackgroundView.backgroundColor = .systemBackground cell.pollOptionView.checkmarkBackgroundView.backgroundColor = Asset.Colors.Background.tertiarySystemBackground.color
cell.pollOptionView.checkmarkBackgroundView.layer.borderColor = UIColor.systemGray3.cgColor cell.pollOptionView.checkmarkBackgroundView.layer.borderColor = Asset.Colors.Background.Cell.highlight.color.withAlphaComponent(0.3).cgColor
cell.pollOptionView.checkmarkBackgroundView.layer.borderWidth = 1 cell.pollOptionView.checkmarkBackgroundView.layer.borderWidth = 1
cell.pollOptionView.checkmarkBackgroundView.isHidden = false cell.pollOptionView.checkmarkBackgroundView.isHidden = false
cell.pollOptionView.checkmarkImageView.isHidden = true cell.pollOptionView.checkmarkImageView.isHidden = true
case .on: case .on:
cell.pollOptionView.checkmarkBackgroundView.backgroundColor = .systemBackground cell.pollOptionView.checkmarkBackgroundView.backgroundColor = Asset.Colors.Background.tertiarySystemBackground.color
cell.pollOptionView.checkmarkBackgroundView.layer.borderColor = UIColor.clear.cgColor cell.pollOptionView.checkmarkBackgroundView.layer.borderColor = UIColor.clear.cgColor
cell.pollOptionView.checkmarkBackgroundView.layer.borderWidth = 0 cell.pollOptionView.checkmarkBackgroundView.layer.borderWidth = 0
cell.pollOptionView.checkmarkBackgroundView.isHidden = false cell.pollOptionView.checkmarkBackgroundView.isHidden = false

View File

@ -7,12 +7,23 @@
import UIKit import UIKit
// MARK: - Convinience view creation method // MARK: - Convenience view creation method
extension UIView { extension UIView {
static let separatorColor: UIColor = {
UIColor(dynamicProvider: { collection in
switch collection.userInterfaceStyle {
case .dark:
return Asset.Colors.Background.Cell.separator.color
default:
return .separator
}
})
}()
static var separatorLine: UIView { static var separatorLine: UIView {
let line = UIView() let line = UIView()
line.backgroundColor = .separator line.backgroundColor = UIView.separatorColor
return line return line
} }

View File

@ -32,6 +32,10 @@ internal enum Asset {
} }
internal enum Colors { internal enum Colors {
internal enum Background { internal enum Background {
internal enum Cell {
internal static let highlight = ColorAsset(name: "Colors/Background/Cell/highlight")
internal static let separator = ColorAsset(name: "Colors/Background/Cell/separator")
}
internal enum Poll { internal enum Poll {
internal static let disabled = ColorAsset(name: "Colors/Background/Poll/disabled") internal static let disabled = ColorAsset(name: "Colors/Background/Poll/disabled")
} }

View File

@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}

View File

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

View File

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

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "67", "blue" : "0x43",
"green" : "53", "green" : "0x35",
"red" : "49" "red" : "0x31"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "55", "blue" : "0x37",
"green" : "44", "green" : "0x2C",
"red" : "40" "red" : "0x28"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "55", "blue" : "0x37",
"green" : "44", "green" : "0x2C",
"red" : "40" "red" : "0x28"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "0x3C", "blue" : "0.216",
"green" : "0x3A", "green" : "0.173",
"red" : "0x3A" "red" : "0.157"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "0x3C", "blue" : "0.263",
"green" : "0x3A", "green" : "0.208",
"red" : "0x3A" "red" : "0.192"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -74,6 +74,11 @@ extension AutoCompleteTableViewCell {
private func _init() { private func _init() {
backgroundColor = .clear backgroundColor = .clear
selectedBackgroundView = {
let view = UIView()
view.backgroundColor = Asset.Colors.Background.Cell.highlight.color
return view
}()
let topPaddingView = UIView() let topPaddingView = UIView()
let bottomPaddingView = UIView() let bottomPaddingView = UIView()

View File

@ -112,7 +112,11 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell {
extension NotificationStatusTableViewCell { extension NotificationStatusTableViewCell {
func configure() { func configure() {
backgroundColor = Asset.Colors.Background.systemBackground.color backgroundColor = Asset.Colors.Background.systemBackground.color
selectedBackgroundView = {
let view = UIView()
view.backgroundColor = Asset.Colors.Background.Cell.highlight.color
return view
}()
let containerStackView = UIStackView() let containerStackView = UIStackView()
containerStackView.axis = .horizontal containerStackView.axis = .horizontal
containerStackView.alignment = .top containerStackView.alignment = .top

View File

@ -130,6 +130,11 @@ final class NotificationTableViewCell: UITableViewCell {
extension NotificationTableViewCell { extension NotificationTableViewCell {
func configure() { func configure() {
backgroundColor = Asset.Colors.Background.systemBackground.color backgroundColor = Asset.Colors.Background.systemBackground.color
selectedBackgroundView = {
let view = UIView()
view.backgroundColor = Asset.Colors.Background.Cell.highlight.color
return view
}()
let containerStackView = UIStackView() let containerStackView = UIStackView()
containerStackView.axis = .vertical containerStackView.axis = .vertical

View File

@ -103,6 +103,7 @@ final class SearchViewController: UIViewController, NeedsDependency {
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)
tableView.separatorColor = UIView.separatorColor
return tableView return tableView
}() }()

View File

@ -103,7 +103,12 @@ extension StatusTableViewCell {
private func _init() { private func _init() {
backgroundColor = Asset.Colors.Background.systemBackground.color backgroundColor = Asset.Colors.Background.systemBackground.color
selectedBackgroundView = {
let view = UIView()
view.backgroundColor = Asset.Colors.Background.Cell.highlight.color
return view
}()
statusView.translatesAutoresizingMaskIntoConstraints = false statusView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(statusView) contentView.addSubview(statusView)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([