fix: connection panel dark mode issue[beta]
This commit is contained in:
parent
740f84c99b
commit
2268b132a2
|
@ -22,10 +22,28 @@ class ConnectionDetailInfoView: NSView {
|
|||
init() {
|
||||
super.init(frame: .zero)
|
||||
wantsLayer = true
|
||||
layer?.backgroundColor = NSColor.white.cgColor
|
||||
updateColor()
|
||||
setupSubviews()
|
||||
}
|
||||
|
||||
override func viewDidChangeEffectiveAppearance() {
|
||||
super.viewDidChangeEffectiveAppearance()
|
||||
updateColor()
|
||||
}
|
||||
|
||||
func updateColor() {
|
||||
if #available(macOS 11.0, *) {
|
||||
effectiveAppearance.performAsCurrentDrawingAppearance {
|
||||
layer?.backgroundColor = NSColor.controlColor.cgColor
|
||||
}
|
||||
} else {
|
||||
let pervious = NSAppearance.current
|
||||
NSAppearance.current = effectiveAppearance
|
||||
layer?.backgroundColor = NSColor.controlColor.cgColor
|
||||
NSAppearance.current = pervious
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue