KMAppearance.swift 833 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // KMAppearance.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2023/4/17.
  6. //
  7. import Cocoa
  8. @objc class KMAppearance: NSObject {
  9. class func isDarkMode() -> Bool {
  10. var result = false
  11. if #available(macOS 10.14, *) {
  12. let appearanceName = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  13. if (appearanceName == .darkAqua) {
  14. return true
  15. }
  16. }
  17. return result
  18. }
  19. @objc class func titleColor() -> NSColor {
  20. if (KMAppearance.isSupportNewColor()) {
  21. return NSColor(named: "KMTitleColor")!
  22. }
  23. return NSColor(hex: "#252629")
  24. }
  25. internal class func isSupportNewColor() -> Bool {
  26. if #available(macOS 10.14, *) {
  27. return true
  28. }
  29. return false
  30. }
  31. }