Skip to content

Commit

Permalink
Improve overall readability (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanzhong authored Nov 18, 2024
1 parent 81becf2 commit cbfe190
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public final class ImageButton: CustomButton {
override public func layout() {
super.layout()

highlightView.layerBackgroundColor = .systemGray.withAlphaComponent(0.15)
highlightView.layerBackgroundColor = .highlightedBackground
highlightView.frame = bounds.insetBy(
dx: Constants.highlightViewInset,
dy: Constants.highlightViewInset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import AppKit

public extension NSColor {
static var highlightedBackground: NSColor {
NSColor(name: nil) {
($0.isDarkMode ? NSColor.white : NSColor.black).withAlphaComponent(0.06)
}
}

@MainActor
func resolvedColor(with appearance: NSAppearance = NSApp.effectiveAppearance) -> NSColor {
var cgColor: CGColor?
Expand Down
1 change: 0 additions & 1 deletion LunarBarMac/Sources/Shared/AppDefinitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ enum Colors {
static let controlAccent: NSColor = .controlAccentColor
static let darkGray: NSColor = .darkGray
static let primaryLabel: NSColor = .labelColor
static let systemGray: NSColor = .systemGray
static let systemTeal: NSColor = .systemTeal
static let systemOrange: NSColor = .systemOrange
}
Expand Down
2 changes: 1 addition & 1 deletion LunarBarMac/Sources/Views/DateGridCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extension DateGridCell {
super.viewDidLayout()
containerView.frame = view.bounds

highlightView.layerBackgroundColor = Colors.systemGray.withAlphaComponent(0.15)
highlightView.layerBackgroundColor = .highlightedBackground
focusRingView.layer?.borderColor = Colors.controlAccent.cgColor
}
}
Expand Down
6 changes: 2 additions & 4 deletions LunarBarMac/Sources/Views/DateGridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ private extension DateGridView {
dataSource?.apply(snapshot, animatingDifferences: animated)

// Force update of certain properties that are not part of the diffable model
if !diffable {
visibleCells.forEach {
$0.updateOpacity(monthDate: monthDate)
}
visibleCells.forEach {
$0.updateOpacity(monthDate: monthDate)
}
}
}
Expand Down

0 comments on commit cbfe190

Please sign in to comment.