diff --git a/Gifski/Assets.xcassets/ButtonTextColor.colorset/Contents.json b/Gifski/Assets.xcassets/ButtonTextColor.colorset/Contents.json new file mode 100644 index 00000000..5aa6fca5 --- /dev/null +++ b/Gifski/Assets.xcassets/ButtonTextColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "mac", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0xFF", + "alpha" : "1.000", + "blue" : "0xFF", + "green" : "0xFF" + } + } + }, + { + "idiom" : "mac", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x00", + "alpha" : "1.000", + "blue" : "0x00", + "green" : "0x00" + } + } + } + ] +} \ No newline at end of file diff --git a/Gifski/Assets.xcassets/Theme.colorset/Contents.json b/Gifski/Assets.xcassets/Theme.colorset/Contents.json deleted file mode 100644 index dbb0c53f..00000000 --- a/Gifski/Assets.xcassets/Theme.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - }, - "colors" : [ - { - "idiom" : "universal", - "color" : { - "color-space" : "srgb", - "components" : { - "red" : "0x33", - "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0x94" - } - } - } - ] -} \ No newline at end of file diff --git a/Gifski/Constants.swift b/Gifski/Constants.swift index 3afa4842..251ece0c 100644 --- a/Gifski/Constants.swift +++ b/Gifski/Constants.swift @@ -1,7 +1,7 @@ import Cocoa extension NSColor { - static let appTheme = NSColor.controlAccentColorPolyfill + static let themeColor = NSColor.controlAccentColorPolyfill } extension Defaults.Keys { diff --git a/Gifski/ConversionCompletedView.swift b/Gifski/ConversionCompletedView.swift index 10ed322e..86d6cbec 100644 --- a/Gifski/ConversionCompletedView.swift +++ b/Gifski/ConversionCompletedView.swift @@ -28,19 +28,24 @@ final class ConversionCompletedView: SSView { $0.spacing = 20 } - private lazy var showInFinderButton = with(CustomButton()) { - $0.title = "Show in Finder" - $0.textColor = .appTheme - $0.backgroundColor = .clear - $0.borderWidth = 1 + private func createButton(title: String) -> CustomButton { + return with(CustomButton()) { + $0.title = title + $0.textColor = .themeColor + // TODO: Custombutton should have a better way of handling different color in dark and light mode + $0.activeTextColor = NSColor(named: "ButtonTextColor")! + $0.backgroundColor = .clear + $0.activeBackgroundColor = .themeColor + $0.borderColor = .themeColor + $0.activeBorderColor = .themeColor + $0.borderWidth = 1 + $0.font = NSFont.systemFont(ofSize: 12, weight: .medium) + } } - private lazy var shareButton = with(CustomButton()) { - $0.title = "Share" - $0.textColor = .appTheme - $0.backgroundColor = .clear - $0.borderWidth = 1 - } + private lazy var showInFinderButton = createButton(title: "Show in Finder") + + private lazy var shareButton = createButton(title: "Share") var fileUrl: URL! { didSet { diff --git a/Gifski/MainWindowController.swift b/Gifski/MainWindowController.swift index 95a3173a..442e0857 100644 --- a/Gifski/MainWindowController.swift +++ b/Gifski/MainWindowController.swift @@ -5,7 +5,7 @@ import Crashlytics final class MainWindowController: NSWindowController { private lazy var circularProgress = with(CircularProgress(size: 160)) { - $0.color = .appTheme + $0.color = .themeColor $0.isHidden = true $0.centerInWindow(window) } @@ -92,7 +92,7 @@ final class MainWindowController: NSWindowController { window.makeKeyAndOrderFront(nil) NSApp.activate(ignoringOtherApps: false) - DockProgress.style = .circle(radius: 55, color: .appTheme) + DockProgress.style = .circle(radius: 55, color: .themeColor) } /// Gets called when the Esc key is pressed. diff --git a/Gifski/VideoDropView.swift b/Gifski/VideoDropView.swift index 5b6b3d09..1c0c957b 100644 --- a/Gifski/VideoDropView.swift +++ b/Gifski/VideoDropView.swift @@ -40,7 +40,7 @@ class DropView: SSView { } } - override init(frame: NSRect) { + override init(frame: CGRect) { super.init(frame: frame) autoresizingMask = [.width, .height] registerForDraggedTypes(acceptedTypes) @@ -64,7 +64,7 @@ class DropView: SSView { } } - override func draw(_ dirtyRect: NSRect) { + override func draw(_ dirtyRect: CGRect) { super.draw(dirtyRect) if isDraggingHighlighted { @@ -107,7 +107,7 @@ final class VideoDropView: DropView { var onComplete: (([URL]) -> Void)? override var highlightColor: NSColor { - return .appTheme + return .themeColor } override var acceptedTypes: [NSPasteboard.PasteboardType] { diff --git a/Gifski/util.swift b/Gifski/util.swift index 69f17098..2f122215 100644 --- a/Gifski/util.swift +++ b/Gifski/util.swift @@ -557,7 +557,7 @@ class Label: NSTextField { /// Use it in Interface Builder as a class or programmatically final class MonospacedLabel: Label { - override init(frame: NSRect) { + override init(frame: CGRect) { super.init(frame: frame) setup() }