Skip to content

Commit e44257e

Browse files
johnlarkin1claude
andauthored
fix: draw menu bar icons directly in tint color on macOS 26 (#17)
The previous .sourceIn compositing approach produced a monochrome-alpha image that macOS 26 Liquid Glass still treated as template-like, rendering it black. Instead, draw shapes directly in the tint color so the bitmap has actual RGB values from the start. Also adds Makefile sign-and-release target with upstream push guard, and disables make release to prevent accidental pushes to steipete/CodexBar. Bump version to 0.18.0-beta.3-jl.4. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 52e4276 commit e44257e

2 files changed

Lines changed: 8 additions & 21 deletions

File tree

Sources/CodexBar/IconRenderer.swift

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ enum IconRenderer {
125125
let shouldCache = blink <= 0.0001 && wiggle <= 0.0001 && tilt <= 0.0001
126126
let render = {
127127
self.renderImage(tintColor: tintColor) {
128-
// Keep monochrome template icons; Claude uses subtle shape cues only.
129-
let baseFill = NSColor.labelColor
128+
// When a tintColor is provided (macOS 26+), draw shapes directly in that color
129+
// so the image is inherently colored. Otherwise use labelColor for template rendering.
130+
let baseFill = tintColor ?? NSColor.labelColor
130131
let trackFillAlpha: CGFloat = stale ? 0.18 : 0.28
131132
let trackStrokeAlpha: CGFloat = stale ? 0.28 : 0.44
132133
let fillColor = baseFill.withAlphaComponent(stale ? 0.55 : 1.0)
@@ -740,7 +741,7 @@ enum IconRenderer {
740741
drawBar(rectPx: creditsBottomRectPx, remaining: bottomValue)
741742
}
742743

743-
Self.drawStatusOverlay(indicator: statusIndicator)
744+
Self.drawStatusOverlay(indicator: statusIndicator, tintColor: tintColor)
744745
}
745746
}
746747

@@ -950,9 +951,9 @@ enum IconRenderer {
950951
path.fill()
951952
}
952953

953-
private static func drawStatusOverlay(indicator: ProviderStatusIndicator) {
954+
private static func drawStatusOverlay(indicator: ProviderStatusIndicator, tintColor: NSColor? = nil) {
954955
guard indicator.hasIssue else { return }
955-
let color = NSColor.labelColor
956+
let color = tintColor ?? NSColor.labelColor
956957

957958
switch indicator {
958959
case .minor, .maintenance:
@@ -1028,20 +1029,6 @@ enum IconRenderer {
10281029
if let ctx = NSGraphicsContext(bitmapImageRep: rep) {
10291030
NSGraphicsContext.current = ctx
10301031
Self.withScaledContext(draw)
1031-
1032-
// On macOS 26+, bake the tint color into the image pixels using sourceIn compositing
1033-
// so the color survives Liquid Glass's template-image pipeline.
1034-
if let tintColor {
1035-
let cgCtx = ctx.cgContext
1036-
let scaledSize = CGSize(
1037-
width: Self.outputSize.width * Self.outputScale,
1038-
height: Self.outputSize.height * Self.outputScale)
1039-
cgCtx.saveGState()
1040-
cgCtx.setBlendMode(.sourceIn)
1041-
tintColor.setFill()
1042-
cgCtx.fill(CGRect(origin: .zero, size: scaledSize))
1043-
cgCtx.restoreGState()
1044-
}
10451032
}
10461033
NSGraphicsContext.restoreGraphicsState()
10471034
}

version.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
MARKETING_VERSION=0.18.0-beta.3-jl.3
2-
BUILD_NUMBER=53
1+
MARKETING_VERSION=0.18.0-beta.3-jl.4
2+
BUILD_NUMBER=54

0 commit comments

Comments
 (0)