-
-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add checkerboard background for the trim view #140
Add checkerboard background for the trim view #140
Conversation
Gifski/CheckerboardView.swift
Outdated
class CheckerboardView: NSView { | ||
let gridSize = CGSize(width: 10, height: 10) | ||
let firstColor = NSColor.white | ||
let secondColor = NSColor.lightGray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit too dark. I would use #d1d1d1
(preferably a semantic color close to this).
Gifski/CheckerboardView.swift
Outdated
secondColor.setFill() | ||
|
||
for y in 0...Int(bounds.size.height / gridSize.height) { | ||
for x in 0...Int(bounds.size.width / gridSize.width) where x % 2 == y % 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this for readability:
extension BinaryInteger {
var isEven: Bool { isMultiple(of: 2) }
var isOdd: Bool { !isEven }
}
Gifski/CheckerboardView.swift
Outdated
import Cocoa | ||
|
||
class CheckerboardView: NSView { | ||
private let gridSize = CGSize(width: 10, height: 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would go for 7px.
Nice trick! |
Should we use a dark checkerboard version in dark mode? |
I think we should. Maybe flip white to black for dark mode? |
Co-Authored-By: Sindre Sorhus <sindresorhus@gmail.com>
@sindresorhus grid size 7px looks not okay at top, so I set 8px: |
Gifski/util.swift
Outdated
static let first = NSColor(named: "CheckerboardFirstColor") ?? NSColor.white | ||
static let second = NSColor(named: "CheckerboardSecondColor") ?? NSColor.lightGray | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this in https://github.com/sindresorhus/Gifski/blob/master/Gifski/Constants.swift and you can just force-unwrap the colors.
Make the second color in dark mode |
Looks great 👌 |
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
Fixes #113
Seems like background color of
AVPlayerView
can't be modified, but we can use a trick.We can add overlay with with a window for video preview. This makes effect of checkerboard background.
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor