Skip to content

Commit

Permalink
Minor refactoring and UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 7, 2019
1 parent 193c715 commit 600804f
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 38 deletions.
38 changes: 38 additions & 0 deletions Gifski/Assets.xcassets/ButtonTextColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
]
}
20 changes: 0 additions & 20 deletions Gifski/Assets.xcassets/Theme.colorset/Contents.json

This file was deleted.

2 changes: 1 addition & 1 deletion Gifski/Constants.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Cocoa

extension NSColor {
static let appTheme = NSColor.controlAccentColorPolyfill
static let themeColor = NSColor.controlAccentColorPolyfill
}

extension Defaults.Keys {
Expand Down
27 changes: 16 additions & 11 deletions Gifski/ConversionCompletedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions Gifski/MainWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions Gifski/VideoDropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DropView: SSView {
}
}

override init(frame: NSRect) {
override init(frame: CGRect) {
super.init(frame: frame)
autoresizingMask = [.width, .height]
registerForDraggedTypes(acceptedTypes)
Expand All @@ -64,7 +64,7 @@ class DropView: SSView {
}
}

override func draw(_ dirtyRect: NSRect) {
override func draw(_ dirtyRect: CGRect) {
super.draw(dirtyRect)

if isDraggingHighlighted {
Expand Down Expand Up @@ -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] {
Expand Down
2 changes: 1 addition & 1 deletion Gifski/util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 600804f

Please sign in to comment.