fix: CGColor not follow user interfaces style issue

This commit is contained in:
CMK 2021-07-22 14:05:20 +08:00
parent a8c29789f5
commit f4056f1049
8 changed files with 19 additions and 29 deletions

View File

@ -34,7 +34,6 @@ internal enum Asset {
internal enum Colors { internal enum Colors {
internal enum Border { internal enum Border {
internal static let composePoll = ColorAsset(name: "Colors/Border/compose.poll") internal static let composePoll = ColorAsset(name: "Colors/Border/compose.poll")
internal static let notificationStatus = ColorAsset(name: "Colors/Border/notification.status")
internal static let searchCard = ColorAsset(name: "Colors/Border/searchCard") internal static let searchCard = ColorAsset(name: "Colors/Border/searchCard")
internal static let status = ColorAsset(name: "Colors/Border/status") internal static let status = ColorAsset(name: "Colors/Border/status")
} }
@ -65,9 +64,6 @@ internal enum Asset {
internal enum Slider { internal enum Slider {
internal static let track = ColorAsset(name: "Colors/Slider/track") internal static let track = ColorAsset(name: "Colors/Slider/track")
} }
internal enum TabBar {
internal static let itemInactive = ColorAsset(name: "Colors/TabBar/item.inactive")
}
internal enum TextField { internal enum TextField {
internal static let background = ColorAsset(name: "Colors/TextField/background") internal static let background = ColorAsset(name: "Colors/TextField/background")
internal static let invalid = ColorAsset(name: "Colors/TextField/invalid") internal static let invalid = ColorAsset(name: "Colors/TextField/invalid")
@ -135,6 +131,7 @@ internal enum Asset {
internal static let tableViewCellSelectionBackground = ColorAsset(name: "Theme/Mastodon/table.view.cell.selection.background") internal static let tableViewCellSelectionBackground = ColorAsset(name: "Theme/Mastodon/table.view.cell.selection.background")
internal static let tertiarySystemBackground = ColorAsset(name: "Theme/Mastodon/tertiary.system.background") internal static let tertiarySystemBackground = ColorAsset(name: "Theme/Mastodon/tertiary.system.background")
internal static let tertiarySystemGroupedBackground = ColorAsset(name: "Theme/Mastodon/tertiary.system.grouped.background") internal static let tertiarySystemGroupedBackground = ColorAsset(name: "Theme/Mastodon/tertiary.system.grouped.background")
internal static let notificationStatusBorderColor = ColorAsset(name: "Theme/Mastodon/notification.status.border.color")
internal static let separator = ColorAsset(name: "Theme/Mastodon/separator") internal static let separator = ColorAsset(name: "Theme/Mastodon/separator")
internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/Mastodon/tab.bar.item.inactive.icon.color") internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/Mastodon/tab.bar.item.inactive.icon.color")
} }
@ -153,6 +150,7 @@ internal enum Asset {
internal static let tableViewCellSelectionBackground = ColorAsset(name: "Theme/system/table.view.cell.selection.background") internal static let tableViewCellSelectionBackground = ColorAsset(name: "Theme/system/table.view.cell.selection.background")
internal static let tertiarySystemBackground = ColorAsset(name: "Theme/system/tertiary.system.background") internal static let tertiarySystemBackground = ColorAsset(name: "Theme/system/tertiary.system.background")
internal static let tertiarySystemGroupedBackground = ColorAsset(name: "Theme/system/tertiary.system.grouped.background") internal static let tertiarySystemGroupedBackground = ColorAsset(name: "Theme/system/tertiary.system.grouped.background")
internal static let notificationStatusBorderColor = ColorAsset(name: "Theme/system/notification.status.border.color")
internal static let separator = ColorAsset(name: "Theme/system/separator") internal static let separator = ColorAsset(name: "Theme/system/separator")
internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/system/tab.bar.item.inactive.icon.color") internal static let tabBarItemInactiveIconColor = ColorAsset(name: "Theme/system/tab.bar.item.inactive.icon.color")
} }

View File

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

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "232", "blue" : "0.910",
"green" : "225", "green" : "0.882",
"red" : "217" "red" : "0.851"
} }
}, },
"idiom" : "universal" "idiom" : "universal"
@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "110", "blue" : "0.431",
"green" : "87", "green" : "0.341",
"red" : "79" "red" : "0.310"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -5,9 +5,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "140", "blue" : "0.910",
"green" : "130", "green" : "0.882",
"red" : "110" "red" : "0.851"
} }
}, },
"idiom" : "universal" "idiom" : "universal"
@ -23,9 +23,9 @@
"color-space" : "srgb", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "200", "blue" : "0.431",
"green" : "174", "green" : "0.341",
"red" : "155" "red" : "0.310"
} }
}, },
"idiom" : "universal" "idiom" : "universal"

View File

@ -90,7 +90,7 @@ final class NotificationStatusTableViewCell: UITableViewCell, StatusCell {
view.layer.cornerRadius = 6 view.layer.cornerRadius = 6
view.layer.cornerCurve = .continuous view.layer.cornerCurve = .continuous
view.layer.borderWidth = 2 view.layer.borderWidth = 2
view.layer.borderColor = Asset.Colors.Border.notificationStatus.color.cgColor view.layer.borderColor = ThemeService.shared.currentTheme.value.notificationStatusBorderColor.cgColor
return view return view
}() }()
let statusView = StatusView() let statusView = StatusView()
@ -272,9 +272,7 @@ extension NotificationStatusTableViewCell {
extension NotificationStatusTableViewCell { extension NotificationStatusTableViewCell {
private func setupBackgroundColor(theme: Theme) { private func setupBackgroundColor(theme: Theme) {
// actionImageView.layer.borderColor = theme.systemBackgroundColor.cgColor statusContainerView.layer.borderColor = theme.notificationStatusBorderColor.resolvedColor(with: traitCollection).cgColor
// avatarImageView.layer.borderColor = Asset.Theme.Mastodon.systemBackground.color.cgColor
statusContainerView.layer.borderColor = Asset.Colors.Border.notificationStatus.color.cgColor
statusContainerView.backgroundColor = UIColor(dynamicProvider: { traitCollection in statusContainerView.backgroundColor = UIColor(dynamicProvider: { traitCollection in
return traitCollection.userInterfaceStyle == .light ? theme.systemBackgroundColor : theme.tertiarySystemGroupedBackgroundColor return traitCollection.userInterfaceStyle == .light ? theme.systemBackgroundColor : theme.tertiarySystemGroupedBackgroundColor
}) })

View File

@ -34,4 +34,5 @@ struct MastodonTheme: Theme {
let contentWarningOverlayBackgroundColor = Asset.Theme.Mastodon.contentWarningOverlayBackground.color let contentWarningOverlayBackgroundColor = Asset.Theme.Mastodon.contentWarningOverlayBackground.color
let profileFieldCollectionViewBackgroundColor = Asset.Theme.Mastodon.profileFieldCollectionViewBackground.color let profileFieldCollectionViewBackgroundColor = Asset.Theme.Mastodon.profileFieldCollectionViewBackground.color
let composeToolbarBackgroundColor = Asset.Theme.Mastodon.composeToolbarBackground.color let composeToolbarBackgroundColor = Asset.Theme.Mastodon.composeToolbarBackground.color
let notificationStatusBorderColor = Asset.Theme.System.notificationStatusBorderColor.color
} }

View File

@ -34,4 +34,5 @@ struct SystemTheme: Theme {
let contentWarningOverlayBackgroundColor = Asset.Theme.System.contentWarningOverlayBackground.color let contentWarningOverlayBackgroundColor = Asset.Theme.System.contentWarningOverlayBackground.color
let profileFieldCollectionViewBackgroundColor = Asset.Theme.System.profileFieldCollectionViewBackground.color let profileFieldCollectionViewBackgroundColor = Asset.Theme.System.profileFieldCollectionViewBackground.color
let composeToolbarBackgroundColor = Asset.Theme.System.composeToolbarBackground.color let composeToolbarBackgroundColor = Asset.Theme.System.composeToolbarBackground.color
let notificationStatusBorderColor = Asset.Theme.System.notificationStatusBorderColor.color
} }

View File

@ -35,6 +35,7 @@ public protocol Theme {
var contentWarningOverlayBackgroundColor: UIColor { get } var contentWarningOverlayBackgroundColor: UIColor { get }
var profileFieldCollectionViewBackgroundColor: UIColor { get } var profileFieldCollectionViewBackgroundColor: UIColor { get }
var composeToolbarBackgroundColor: UIColor { get } var composeToolbarBackgroundColor: UIColor { get }
var notificationStatusBorderColor: UIColor { get }
} }