style: widen number fade and brighten larger badges
This commit is contained in:
@@ -726,7 +726,10 @@ final class ApplicationCell: NSTableCellView {
|
||||
|
||||
let locationLabel = NSTextField(labelWithString: "")
|
||||
let kindLabel = NSTextField(labelWithString: "Application")
|
||||
let numberHint = ShortcutIndicator("1", backgroundColor: SunsetPalette.background.withAlphaComponent(1))
|
||||
let numberHint = ShortcutIndicator(
|
||||
"1", backgroundColor: NSColor(srgbRed: 0.26, green: 0.22, blue: 0.19, alpha: 1),
|
||||
fontSize: 14, keySize: 22
|
||||
)
|
||||
private let kindFade = CAGradientLayer()
|
||||
private var numberHintVisible = false
|
||||
private var hintGeneration = 0
|
||||
@@ -852,7 +855,7 @@ final class ApplicationCell: NSTableCellView {
|
||||
// Extend the mask so its moving left edge never clips the start of the label.
|
||||
kindFade.bounds = CGRect(x: 0, y: 0, width: width, height: kindLabel.bounds.height)
|
||||
kindFade.position = CGPoint(x: kindLabel.bounds.midX, y: kindLabel.bounds.midY)
|
||||
kindFade.startPoint = CGPoint(x: max(0, min(1, (badgeLeading - 18) / width)), y: 0.5)
|
||||
kindFade.startPoint = CGPoint(x: max(0, min(1, (badgeLeading - 36) / width)), y: 0.5)
|
||||
kindFade.endPoint = CGPoint(x: max(0, min(1, (badgeLeading + 2) / width)), y: 0.5)
|
||||
CATransaction.commit()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import CoreText
|
||||
|
||||
@MainActor
|
||||
final class ShortcutIndicator: NSStackView {
|
||||
init(_ keys: String..., backgroundColor: NSColor? = nil) {
|
||||
init(_ keys: String..., backgroundColor: NSColor? = nil, fontSize: CGFloat = 12, keySize: CGFloat = 18) {
|
||||
super.init(frame: .zero)
|
||||
orientation = .horizontal
|
||||
alignment = .centerY
|
||||
@@ -14,7 +14,7 @@ final class ShortcutIndicator: NSStackView {
|
||||
setAccessibilityElement(false)
|
||||
for key in keys {
|
||||
let badge = ShortcutKeyBadge(labelWithString: key)
|
||||
badge.font = .systemFont(ofSize: 12, weight: .medium)
|
||||
badge.font = .systemFont(ofSize: fontSize, weight: .medium)
|
||||
badge.textColor = SunsetPalette.secondaryText
|
||||
badge.alignment = .center
|
||||
badge.wantsLayer = true
|
||||
@@ -25,8 +25,8 @@ final class ShortcutIndicator: NSStackView {
|
||||
badge.setAccessibilityElement(false)
|
||||
badge.translatesAutoresizingMaskIntoConstraints = false
|
||||
NSLayoutConstraint.activate([
|
||||
badge.widthAnchor.constraint(equalToConstant: 18),
|
||||
badge.heightAnchor.constraint(equalToConstant: 18)
|
||||
badge.widthAnchor.constraint(equalToConstant: keySize),
|
||||
badge.heightAnchor.constraint(equalToConstant: keySize)
|
||||
])
|
||||
addArrangedSubview(badge)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user