KMTabAppearance.swift 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // KMTabAppearance.swift
  3. // PDF Master
  4. //
  5. // Created by wanjun on 2022/12/9.
  6. //
  7. import Cocoa
  8. @objcMembers class KMTabAppearance: NSObject {
  9. class func tabsTitleColor() -> NSColor? {
  10. if #available(macOS 10.14, *) {
  11. return NSColor(named: "KMTabsTitleColor")
  12. } else {
  13. return NSColor(red: 87.0 / 255.0, green: 91.0 / 255.0, blue: 117.0 / 255.0, alpha: 1.0)
  14. }
  15. }
  16. class func tabsBackgroundColor() -> NSColor? {
  17. var tabsViewBackgroundColor = NSColor(red: 198.0 / 255.0, green: 198.0 / 255.0, blue: 198.0 / 255.0, alpha: 1.0)
  18. if #available(macOS 10.14, *) {
  19. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  20. if appearanceName == .darkAqua {
  21. tabsViewBackgroundColor = NSColor(red: 73.0 / 255.0, green: 73.0 / 255.0, blue: 73.0 / 255.0, alpha: 1.0)
  22. }
  23. }
  24. return tabsViewBackgroundColor
  25. }
  26. class func tabsActiveBackgroundColor() -> NSColor? {
  27. var tabsViewBackgroundColor = NSColor(red: 247.0 / 255.0, green: 247.0 / 255.0, blue: 247.0 / 255.0, alpha: 1.0)
  28. if #available(macOS 10.14, *) {
  29. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  30. if appearanceName == .darkAqua {
  31. tabsViewBackgroundColor = NSColor(red: 51.0 / 255.0, green: 51.0 / 255.0, blue: 51.0 / 255.0, alpha: 1.0)
  32. }
  33. }
  34. return tabsViewBackgroundColor
  35. }
  36. class func tabsViewBackgroundColor() -> NSColor? {
  37. var tabsViewBackgroundColor = NSColor(red: 210.0 / 255.0, green: 210.0 / 255.0, blue: 210.0 / 255.0, alpha: 1.0)
  38. if #available(macOS 10.14, *) {
  39. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  40. if appearanceName == .darkAqua {
  41. tabsViewBackgroundColor = NSColor(red: 61.0 / 255.0, green: 61.0 / 255.0, blue: 61.0 / 255.0, alpha: 1.0)
  42. }
  43. }
  44. return tabsViewBackgroundColor
  45. }
  46. class func tabsBorderColor() -> NSColor? {
  47. if #available(macOS 10.14, *) {
  48. return NSColor(named: "KMTabsBorderColor")
  49. } else {
  50. return NSColor(red: 0 / 255.0, green: 0 / 255.0, blue: 0 / 255.0, alpha: 0.27)
  51. }
  52. }
  53. class func mainToolBarBackgroundColor() -> NSColor? {
  54. var mainToolBarBackgroundColor = NSColor(red: 247.0 / 255.0, green: 247.0 / 255.0, blue: 247.0 / 255.0, alpha: 1.0)
  55. if #available(macOS 10.14, *) {
  56. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  57. if appearanceName == .darkAqua {
  58. mainToolBarBackgroundColor = NSColor(red: 51.0 / 255.0, green: 51.0 / 255.0, blue: 51.0 / 255.0, alpha: 1.0)
  59. }
  60. }
  61. return mainToolBarBackgroundColor
  62. }
  63. class func childToolBarBackgroundColor() -> NSColor? {
  64. var childToolBarBackgroundColor = NSColor(red: 234.0 / 255.0, green: 234.0 / 255.0, blue: 234.0 / 255.0, alpha: 0.87)
  65. if #available(macOS 10.14, *) {
  66. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  67. if appearanceName == .darkAqua {
  68. childToolBarBackgroundColor = NSColor(red: 12.0 / 255.0, green: 12.0 / 255.0, blue: 12.0 / 255.0, alpha: 0.87)
  69. }
  70. }
  71. return childToolBarBackgroundColor
  72. }
  73. class func mainToolBarBorderColor() -> NSColor? {
  74. var childToolBarBackgroundColor = NSColor(red: 192.0 / 255.0, green: 192.0 / 255.0, blue: 192.0 / 255.0, alpha: 0.6)
  75. if #available(macOS 10.14, *) {
  76. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  77. if appearanceName == .darkAqua {
  78. childToolBarBackgroundColor = NSColor(red: 0 / 255.0, green: 0 / 255.0, blue: 0 / 255.0, alpha: 0.6)
  79. }
  80. }
  81. return childToolBarBackgroundColor
  82. }
  83. class func childToolBarBorderColor() -> NSColor? {
  84. var childToolBarBackgroundColor = NSColor(red: 192.0 / 255.0, green: 192.0 / 255.0, blue: 192.0 / 255.0, alpha: 1.0)
  85. if #available(macOS 10.14, *) {
  86. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  87. if appearanceName == .darkAqua {
  88. childToolBarBackgroundColor = NSColor(red: 0 / 255.0, green: 0 / 255.0, blue: 0 / 255.0, alpha: 0.6)
  89. }
  90. }
  91. return childToolBarBackgroundColor
  92. }
  93. class func bottomToolBarBackgroundColor() -> NSColor? {
  94. var childToolBarBackgroundColor = NSColor(red: 226.0 / 255.0, green: 226.0 / 255.0, blue: 192.0 / 226.0, alpha: 0.87)
  95. if #available(macOS 10.14, *) {
  96. let appearanceName: NSAppearance.Name? = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
  97. if appearanceName == .darkAqua {
  98. childToolBarBackgroundColor = NSColor(red: 45.0 / 255.0, green: 45.0 / 255.0, blue: 45.0 / 255.0, alpha: 0.87)
  99. }
  100. }
  101. return childToolBarBackgroundColor
  102. }
  103. }