aboutsummaryrefslogtreecommitdiff
path: root/menubar/model.swift
diff options
context:
space:
mode:
Diffstat (limited to 'menubar/model.swift')
-rw-r--r--menubar/model.swift16
1 files changed, 13 insertions, 3 deletions
diff --git a/menubar/model.swift b/menubar/model.swift
index b4a54a0..e60cb84 100644
--- a/menubar/model.swift
+++ b/menubar/model.swift
@@ -19,6 +19,15 @@ let herdrYellow = herdrColor(dark: (249, 226, 175), light: (223, 142, 29))
let herdrGreen = herdrColor(dark: (166, 227, 161), light: (64, 160, 43))
let herdrGray = herdrColor(dark: (108, 112, 134), light: (156, 160, 176))
+/// herdr's mocha text colors, fixed (not appearance-dependent) for the
+/// always-dark floating panel.
+func mocha(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat, _ a: CGFloat = 1) -> NSColor {
+ NSColor(srgbRed: r / 255, green: g / 255, blue: b / 255, alpha: a)
+}
+let mochaText = mocha(205, 214, 244)
+let mochaSubtext = mocha(166, 173, 200)
+let mochaOverlay = mocha(108, 112, 134)
+
// MARK: herdr's status vocabulary
enum Status: String {
@@ -55,7 +64,7 @@ enum Status: String {
}
}
-struct Row {
+struct Row: Equatable {
let paneId: String
let agent: String
/// What the agent works on (its session/task name), if it has one.
@@ -187,13 +196,14 @@ func plainTitle(for rows: [Row]) -> String {
/// Row title: the colored status symbol, then the agent's name. Unnamed
/// agents show their harness, dimmed, so it never competes with real names.
-func rowTitle(_ row: Row) -> NSAttributedString {
+func rowTitle(_ row: Row, primary: NSColor = .labelColor,
+ secondary: NSColor = .secondaryLabelColor) -> NSAttributedString {
let font = NSFont.menuFont(ofSize: 0)
let mono = NSFont.monospacedSystemFont(ofSize: font.pointSize, weight: .medium)
let text = NSMutableAttributedString()
text.append(NSAttributedString(
string: "\(row.status.symbol) ", attributes: [.font: mono, .foregroundColor: row.status.color]))
- let labelColor = row.name.isEmpty ? NSColor.secondaryLabelColor : NSColor.labelColor
+ let labelColor = row.name.isEmpty ? secondary : primary
text.append(NSAttributedString(
string: row.label, attributes: [.font: font, .foregroundColor: labelColor]))
return text