42 lines · 1.3 KB · Swift
RawDownload
import SwiftUI private struct MenuItemHighlightedKey: EnvironmentKey {    static let defaultValue = false} extension EnvironmentValues {    var menuItemHighlighted: Bool {        get { self[MenuItemHighlightedKey.self] }        set { self[MenuItemHighlightedKey.self] = newValue }    }} enum MenuHighlightStyle {    static let selectionText = Color(nsColor: .selectedMenuItemTextColor)    static let normalPrimaryText = Color(nsColor: .controlTextColor)    static let normalSecondaryText = Color(nsColor: .secondaryLabelColor)     static func primary(_ highlighted: Bool) -> Color {        highlighted ? self.selectionText : self.normalPrimaryText    }     static func secondary(_ highlighted: Bool) -> Color {        highlighted ? self.selectionText : self.normalSecondaryText    }     static func error(_ highlighted: Bool) -> Color {        highlighted ? self.selectionText : Color(nsColor: .systemRed)    }     static func progressTrack(_ highlighted: Bool) -> Color {        highlighted ? self.selectionText.opacity(0.35) : Color.secondary.opacity(0.25)    }     static func progressTint(_ highlighted: Bool, fallback: Color) -> Color {        highlighted ? self.selectionText : fallback    }     static func selectionBackground(_ highlighted: Bool) -> Color {        highlighted ? Color(nsColor: .selectedContentBackgroundColor) : .clear    }}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t