123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //
- // KMAppearance.swift
- // PDF Master
- //
- // Created by tangchao on 2023/4/17.
- //
- import Cocoa
- @objc class KMAppearance: NSObject {
-
- class func isDarkMode() -> Bool {
- var result = false
- if #available(macOS 10.14, *) {
- let appearanceName = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
- if (appearanceName == .darkAqua) {
- return true
- }
- }
- return result
- }
- @objc class func titleColor() -> NSColor {
- if (!KMAppearance.isSupportNewColor()) {
- return NSColor.km_init(hex: "#252629")
- }
- if let _color = NSColor(named: "KMTitleColor") {
- return _color
- }
- return NSColor.km_init(hex: "#252629")
- }
-
- @objc class func subtitleColor() -> NSColor {
- if (!KMAppearance.isSupportNewColor()) {
- return NSColor.km_init(hex: "#616469")
- }
- if let _color = NSColor(named: "KMSubtitleColor") {
- return _color
- }
- return NSColor.km_init(hex: "#616469")
- }
-
- @objc class func view_bg_dis_color() -> NSColor {
- if (!KMAppearance.isSupportNewColor()) {
- return NSColor.km_init(hex: "#EDEEF0")
- }
- if let _color = NSColor(named: "KMBackgroundDisableColor") {
- return _color
- }
- return NSColor.km_init(hex: "#EDEEF0")
- }
-
- @objc class func view_border_dis_color() -> NSColor {
- if (!KMAppearance.isSupportNewColor()) {
- return NSColor.km_init(hex: "#DFE1E5")
- }
- if let _color = NSColor(named: "KMBorderDisableColor") {
- return _color
- }
- return NSColor.km_init(hex: "#DFE1E5")
- }
-
- class func isSupportNewColor() -> Bool {
- if #available(macOS 10.14, *) {
- return true
- }
- return false
- }
- }
|