|
|
@ -49,12 +49,10 @@ class Themer: NSObject { |
|
|
|
name: .interfaceStyleDidChange, |
|
|
|
name: .interfaceStyleDidChange, |
|
|
|
object: nil) |
|
|
|
object: nil) |
|
|
|
|
|
|
|
|
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
effectiveApperanceObserver = NSApp.observe(\.effectiveAppearance) { _, _ in |
|
|
|
effectiveApperanceObserver = NSApp.observe(\.effectiveAppearance) { _, _ in |
|
|
|
NotificationCenter.default.post(name: .themeDidChangeNotification, object: nil) |
|
|
|
NotificationCenter.default.post(name: .themeDidChangeNotification, object: nil) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
extension Themer { |
|
|
|
extension Themer { |
|
|
@ -116,7 +114,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func mainBackgroundColor() -> NSColor { |
|
|
|
func mainBackgroundColor() -> NSColor { |
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
switch themeIndex { |
|
|
|
switch themeIndex { |
|
|
|
case .light: |
|
|
|
case .light: |
|
|
|
return NSColor.white |
|
|
|
return NSColor.white |
|
|
@ -131,11 +128,7 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return themeIndex == .light ? NSColor.white : NSColor(deviceRed: 55.0 / 255.0, green: 71.0 / 255.0, blue: 79.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func textBackgroundColor() -> NSColor { |
|
|
|
func textBackgroundColor() -> NSColor { |
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
switch themeIndex { |
|
|
|
switch themeIndex { |
|
|
|
case .light: |
|
|
|
case .light: |
|
|
|
return NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) |
|
|
|
return NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) |
|
|
@ -150,13 +143,7 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return themeIndex == .light ? |
|
|
|
|
|
|
|
NSColor(deviceRed: 241.0 / 255.0, green: 241.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) : |
|
|
|
|
|
|
|
NSColor(deviceRed: 42.0 / 255.0, green: 55.0 / 255.0, blue: 62.0 / 255.0, alpha: 1.0) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func mainTextColor() -> NSColor { |
|
|
|
func mainTextColor() -> NSColor { |
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
switch themeIndex { |
|
|
|
switch themeIndex { |
|
|
|
case .light: |
|
|
|
case .light: |
|
|
|
return NSColor.black |
|
|
|
return NSColor.black |
|
|
@ -171,9 +158,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return themeIndex == .light ? NSColor.black : NSColor.white |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Images |
|
|
|
// MARK: Images |
|
|
|
|
|
|
|
|
|
|
|
func shutdownImage() -> NSImage { |
|
|
|
func shutdownImage() -> NSImage { |
|
|
@ -256,7 +240,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func menubarOnboardingImage() -> NSImage { |
|
|
|
func menubarOnboardingImage() -> NSImage { |
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
switch themeIndex { |
|
|
|
switch themeIndex { |
|
|
|
case .system: |
|
|
|
case .system: |
|
|
|
return NSImage(named: NSImage.Name("Dynamic Menubar"))! |
|
|
|
return NSImage(named: NSImage.Name("Dynamic Menubar"))! |
|
|
@ -267,9 +250,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return retrieveCurrentSystem() == .dark ? NSImage(named: NSImage.Name("Dark Menubar"))! : NSImage(named: NSImage.Name("Light Menubar"))! |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func extraOptionsHighlightedImage() -> NSImage { |
|
|
|
func extraOptionsHighlightedImage() -> NSImage { |
|
|
|
return fallbackImageProvider(NSImage(named: NSImage.Name("ExtraHighlighted"))!, |
|
|
|
return fallbackImageProvider(NSImage(named: NSImage.Name("ExtraHighlighted"))!, |
|
|
|
NSImage(named: NSImage.Name("ExtraWhiteHighlighted"))!, |
|
|
|
NSImage(named: NSImage.Name("ExtraWhiteHighlighted"))!, |
|
|
@ -319,7 +299,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func popoverAppearance() -> NSAppearance { |
|
|
|
func popoverAppearance() -> NSAppearance { |
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
switch themeIndex { |
|
|
|
switch themeIndex { |
|
|
|
case .light, .solarizedLight: |
|
|
|
case .light, .solarizedLight: |
|
|
|
return NSAppearance(named: NSAppearance.Name.vibrantLight)! |
|
|
|
return NSAppearance(named: NSAppearance.Name.vibrantLight)! |
|
|
@ -330,9 +309,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return themeIndex == .light ? NSAppearance(named: NSAppearance.Name.vibrantLight)! : NSAppearance(named: NSAppearance.Name.vibrantDark)! |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func addImage() -> NSImage { |
|
|
|
func addImage() -> NSImage { |
|
|
|
if let symbolImageForPreference = symbolImage(for: "plus") { |
|
|
|
if let symbolImageForPreference = symbolImage(for: "plus") { |
|
|
|
return symbolImageForPreference |
|
|
|
return symbolImageForPreference |
|
|
@ -457,7 +433,6 @@ extension Themer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func setAppAppearance() { |
|
|
|
private func setAppAppearance() { |
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
var appAppearance = NSAppearance(named: .aqua) |
|
|
|
var appAppearance = NSAppearance(named: .aqua) |
|
|
|
|
|
|
|
|
|
|
|
if themeIndex == .dark || themeIndex == .solarizedDark { |
|
|
|
if themeIndex == .dark || themeIndex == .solarizedDark { |
|
|
@ -468,7 +443,7 @@ extension Themer { |
|
|
|
if NSApp.appearance != appAppearance { |
|
|
|
if NSApp.appearance != appAppearance { |
|
|
|
NSApp.appearance = appAppearance |
|
|
|
NSApp.appearance = appAppearance |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func fallbackImageProvider(_ lightImage: NSImage, |
|
|
|
private func fallbackImageProvider(_ lightImage: NSImage, |
|
|
@ -477,7 +452,6 @@ extension Themer { |
|
|
|
_ solarizedLightImage: NSImage, |
|
|
|
_ solarizedLightImage: NSImage, |
|
|
|
_ solarizedDarkImage: NSImage) -> NSImage |
|
|
|
_ solarizedDarkImage: NSImage) -> NSImage |
|
|
|
{ |
|
|
|
{ |
|
|
|
if #available(macOS 10.14, *) { |
|
|
|
|
|
|
|
switch themeIndex { |
|
|
|
switch themeIndex { |
|
|
|
case .light: |
|
|
|
case .light: |
|
|
|
return lightImage |
|
|
|
return lightImage |
|
|
@ -491,7 +465,4 @@ extension Themer { |
|
|
|
return solarizedDarkImage |
|
|
|
return solarizedDarkImage |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return themeIndex == .light ? lightImage : darkImage |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|