Skip to content

Commit

Permalink
Change background color of the stack views when dark mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mm512 committed Aug 30, 2019
1 parent fe0e7bf commit cc22c3c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Source/View Controllers/TCCProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,29 @@ class TCCProfileViewController: NSViewController {
}

private func setupStackViewsWithBackground(stackViews: [NSStackView]) {
let darkModeEnabled = isDarkModeEnabled()

for stackView in stackViews {
stackView.wantsLayer = true
stackView.layer?.backgroundColor = NSColor(red: 0.955, green: 0.96, blue: 0.96, alpha: 1.0).cgColor
if darkModeEnabled {
stackView.layer?.backgroundColor = NSColor(red: 0.157, green: 0.165, blue: 0.173, alpha: 1.0).cgColor
} else {
stackView.layer?.backgroundColor = NSColor(red: 0.955, green: 0.96, blue: 0.96, alpha: 1.0).cgColor
}
}
}

private func isDarkModeEnabled() -> Bool {
var darkModeEnabled = false
if #available(OSX 10.14, *) {
if view.effectiveAppearance.name == .darkAqua {
darkModeEnabled = true
}
}

return darkModeEnabled
}

private func setupDescriptions() {
addressBookHelpButton.setHelpMessage(ProfilesDescriptions.addressBook.rawValue)
photosHelpButton.setHelpMessage(ProfilesDescriptions.photos.rawValue)
Expand Down

0 comments on commit cc22c3c

Please sign in to comment.