|
|
@@ -19,6 +19,14 @@ private enum PremiumSheetLayout {
|
|
|
static let overscanExtraTop: CGFloat = 0.5
|
|
|
}
|
|
|
|
|
|
+private enum SettingsAppearanceID {
|
|
|
+ static let section = "dashboard.settings.section"
|
|
|
+ static let sectionHeader = "dashboard.settings.sectionHeader"
|
|
|
+ static let rowTitle = "dashboard.settings.rowTitle"
|
|
|
+ static let iconTile = "dashboard.settings.iconTile"
|
|
|
+ static let divider = "dashboard.settings.divider"
|
|
|
+}
|
|
|
+
|
|
|
final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDelegate, NSSharingServiceDelegate {
|
|
|
/// Indeed.com-inspired neutrals and brand blue; values follow light / dark / system appearance.
|
|
|
private enum Theme {
|
|
|
@@ -292,27 +300,26 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
}
|
|
|
|
|
|
private func refreshSettingsPageAppearance(in root: NSView) {
|
|
|
- for case let field as NSTextField in root.subviewsRecursive() where !field.isEditable {
|
|
|
- switch field.font?.pointSize {
|
|
|
- case 12, 14:
|
|
|
- field.textColor = Theme.secondaryText
|
|
|
+ for view in root.subviewsRecursive() {
|
|
|
+ switch view.identifier?.rawValue {
|
|
|
+ case SettingsAppearanceID.section:
|
|
|
+ view.layer?.backgroundColor = Theme.settingsGroupBackground.cgColor
|
|
|
+ view.layer?.borderColor = Theme.border.cgColor
|
|
|
+ case SettingsAppearanceID.divider:
|
|
|
+ view.layer?.backgroundColor = Theme.settingsDivider.cgColor
|
|
|
+ case SettingsAppearanceID.iconTile:
|
|
|
+ view.layer?.backgroundColor = Theme.settingsIconBackground.cgColor
|
|
|
+ for case let icon as NSImageView in view.subviews {
|
|
|
+ icon.contentTintColor = Theme.brandBlue
|
|
|
+ }
|
|
|
+ case SettingsAppearanceID.sectionHeader:
|
|
|
+ (view as? NSTextField)?.textColor = Theme.secondaryText
|
|
|
+ case SettingsAppearanceID.rowTitle:
|
|
|
+ (view as? NSTextField)?.textColor = Theme.primaryText
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- for case let stack as NSStackView in root.subviewsRecursive() where stack.orientation == .vertical && stack.layer?.cornerRadius == 14 {
|
|
|
- stack.layer?.backgroundColor = Theme.settingsGroupBackground.cgColor
|
|
|
- stack.layer?.borderColor = Theme.border.cgColor
|
|
|
- for case let divider as NSView in stack.arrangedSubviews where divider.bounds.height <= 1.5 && divider.wantsLayer {
|
|
|
- divider.layer?.backgroundColor = Theme.settingsDivider.cgColor
|
|
|
- }
|
|
|
- }
|
|
|
- for case let tile as NSView in root.subviewsRecursive() where tile.layer?.cornerRadius == 9 && tile.bounds.width == 38 {
|
|
|
- tile.layer?.backgroundColor = Theme.settingsIconBackground.cgColor
|
|
|
- for case let icon as NSImageView in tile.subviews {
|
|
|
- icon.contentTintColor = Theme.brandBlue
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private func rebuildFeatureShortcutCards() {
|
|
|
@@ -1669,6 +1676,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
appearanceTitle.font = .systemFont(ofSize: 12, weight: .semibold)
|
|
|
appearanceTitle.textColor = Theme.secondaryText
|
|
|
appearanceTitle.alignment = .left
|
|
|
+ appearanceTitle.identifier = NSUserInterfaceItemIdentifier(SettingsAppearanceID.sectionHeader)
|
|
|
|
|
|
let themeSegment = makeAppearanceModeSegment()
|
|
|
appearanceModeSegment = themeSegment
|
|
|
@@ -1691,6 +1699,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
aboutTitle.font = .systemFont(ofSize: 12, weight: .semibold)
|
|
|
aboutTitle.textColor = Theme.secondaryText
|
|
|
aboutTitle.alignment = .left
|
|
|
+ aboutTitle.identifier = NSUserInterfaceItemIdentifier(SettingsAppearanceID.sectionHeader)
|
|
|
|
|
|
let aboutSection = makeSettingsSection(rows: [
|
|
|
makeSettingsRow(title: "Website", systemImage: "globe", accessory: nil, tapAction: #selector(didTapWebsite)),
|
|
|
@@ -1750,6 +1759,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
section.alignment = .leading
|
|
|
section.translatesAutoresizingMaskIntoConstraints = false
|
|
|
section.wantsLayer = true
|
|
|
+ section.identifier = NSUserInterfaceItemIdentifier(SettingsAppearanceID.section)
|
|
|
section.layer?.backgroundColor = Theme.settingsGroupBackground.cgColor
|
|
|
section.layer?.cornerRadius = 14
|
|
|
section.layer?.borderWidth = 1
|
|
|
@@ -1764,6 +1774,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
let divider = NSView()
|
|
|
divider.translatesAutoresizingMaskIntoConstraints = false
|
|
|
divider.wantsLayer = true
|
|
|
+ divider.identifier = NSUserInterfaceItemIdentifier(SettingsAppearanceID.divider)
|
|
|
divider.layer?.backgroundColor = Theme.settingsDivider.cgColor
|
|
|
section.addArrangedSubview(divider)
|
|
|
NSLayoutConstraint.activate([
|
|
|
@@ -1785,6 +1796,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
let iconTile = NSView()
|
|
|
iconTile.translatesAutoresizingMaskIntoConstraints = false
|
|
|
iconTile.wantsLayer = true
|
|
|
+ iconTile.identifier = NSUserInterfaceItemIdentifier(SettingsAppearanceID.iconTile)
|
|
|
iconTile.layer?.backgroundColor = Theme.settingsIconBackground.cgColor
|
|
|
iconTile.layer?.cornerRadius = 9
|
|
|
|
|
|
@@ -1796,8 +1808,9 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
|
|
|
let titleLabel = NSTextField(labelWithString: title)
|
|
|
titleLabel.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
- titleLabel.textColor = Theme.secondaryText
|
|
|
+ titleLabel.textColor = Theme.primaryText
|
|
|
titleLabel.alignment = .left
|
|
|
+ titleLabel.identifier = NSUserInterfaceItemIdentifier(SettingsAppearanceID.rowTitle)
|
|
|
|
|
|
let rowStack = NSStackView()
|
|
|
rowStack.orientation = .horizontal
|
|
|
@@ -1840,6 +1853,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
rowButton.setButtonType(.momentaryChange)
|
|
|
rowButton.focusRingType = .none
|
|
|
rowButton.wantsLayer = true
|
|
|
+ rowButton.appearance = NSApp.appearance
|
|
|
rowButton.layer?.backgroundColor = .clear
|
|
|
row.addSubview(rowButton)
|
|
|
NSLayoutConstraint.activate([
|