diff --git a/Source/Modules/AppDelegate.swift b/Source/Modules/AppDelegate.swift index c0e51087..4f9aca18 100644 --- a/Source/Modules/AppDelegate.swift +++ b/Source/Modules/AppDelegate.swift @@ -299,4 +299,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega NSLog("vChewingErrorCallback: %@", strPrint) } } + @objc static func isDarkMode() -> Bool { + if #available(macOS 10.15, *) { + let appearanceDescription = NSApplication.shared.effectiveAppearance.debugDescription.lowercased() + if appearanceDescription.contains("dark") { + return true + } + } else if #available(macOS 10.14, *) { + if let appleInterfaceStyle = UserDefaults.standard.object(forKey: "AppleInterfaceStyle") as? String { + if appleInterfaceStyle.lowercased().contains("dark") { + return true + } + } + } + return false + } }