Skip to content

Commit

Permalink
Reduce transparency slightly by default (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanzhong authored Jan 11, 2024
1 parent 28b3a28 commit e36efad
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import AppKit

public extension NSPopover {
var reduceTransparency: Bool {
var material: NSVisualEffectView.Material {
get {
visualEffectView?.material == .windowBackground
visualEffectView?.material ?? .popover
}
set {
visualEffectView?.material = newValue ? .windowBackground : .popover
visualEffectView?.material = newValue
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion LunarBarMac/Sources/Main/AppMainVC+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private extension AppMainVC {

menu.addItem(withTitle: Localized.UI.menuTitleReduceTransparency) { [weak self] in
AppPreferences.Accessibility.reduceTransparency.toggle()
self?.popover?.reduceTransparency = AppPreferences.Accessibility.reduceTransparency
self?.popover?.material = AppPreferences.Accessibility.popoverMaterial
}
.setOn(AppPreferences.Accessibility.reduceTransparency)

Expand Down
2 changes: 1 addition & 1 deletion LunarBarMac/Sources/Main/AppMainVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension AppMainVC {

override func viewDidAppear() {
super.viewDidAppear()
popover?.reduceTransparency = AppPreferences.Accessibility.reduceTransparency
popover?.material = AppPreferences.Accessibility.popoverMaterial

updateAppearance()
updateCalendar()
Expand Down
4 changes: 4 additions & 0 deletions LunarBarMac/Sources/Shared/AppPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ enum AppPreferences {

@Storage(key: "accessibility.reduce-transparency", defaultValue: false)
static var reduceTransparency: Bool

static var popoverMaterial: NSVisualEffectView.Material {
reduceTransparency ? .windowBackground : .menu
}
}
}

Expand Down
Binary file modified Screenshots/01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Screenshots/02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e36efad

Please sign in to comment.