feat: fix menu bar colors not showing on macOS 26 (Liquid Glass)#16
Merged
Conversation
macOS 26 Liquid Glass overrides contentTintColor on template images in the menu bar, breaking CodexBar's color-coded usage icons. On macOS 26+, bake the tint color directly into image pixels using sourceIn compositing and set isTemplate=false. On older macOS, keep the existing template + contentTintColor approach unchanged. Also modernizes deprecated APIs: - Replace lockFocus/unlockFocus with NSImage(size:flipped:drawingHandler:) - Replace deviceRGB with calibratedRGB for consistent rendering - Replace NSColor(deviceRed:) with NSColor(red:green:blue:alpha:) - Add appearance change observer to re-render on dark/light mode switch Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
This PR was created by Claude Code. Take an extra sec to review. Or don't and trust the robots and process.
Summary
contentTintColoron template images.Motivation & Context
macOS 26 introduces "Liquid Glass" for the menu bar, which changes how template images are composited. CodexBar's color pipeline (
IconRendererdraws monochrome template +StatusItemControllerappliescontentTintColor) is broken because Liquid Glass overrides/ignorescontentTintColoron template images. This means all usage icons appear monochrome regardless of usage level.Key Changes
tintColoris provided,IconRenderer.renderImage()composites the color over the drawn alpha mask using.sourceInblend mode and setsisTemplate = false. On older macOS, the existingcontentTintColorpath is unchanged.applyIcon(): Both unified and per-provider icon paths passtintColordirectly toIconRendereron macOS 26+, clearingcontentTintColor. Brand icons get a similar treatment viatintedBrandImage().NSApp.effectiveAppearanceto re-render icons when appearance changes (macOS 26+ only).tintHashfield (RGBA quantized to 256 buckets per channel) to prevent cache collisions between tinted and untinted icons.lockFocus/unlockFocus→NSImage(size:flipped:drawingHandler:)(3 locations + 1 test).deviceRGB→.calibratedRGBfor consistent cross-display renderingNSColor(deviceRed:)→NSColor(red:green:blue:alpha:)with explicit CGFloat conversionCritical Files Touched
Sources/CodexBar/IconRenderer.swift.calibratedRGB, removed lockFocus fallback, addedtintColorparam + cache keySources/CodexBar/StatusItemController+Animation.swiftapplyIcon()methods,tintedBrandImage()helper, modernizedbrandImageWithStatusOverlaySources/CodexBar/StatusItemController+SwitcherViews.swiftNSColor(red:)fix, modernizedpaddedImageSources/CodexBar/StatusItemController.swiftTests/CodexBarTests/StatusItemAnimationTests.swiftHow to Test
swift buildpassesswift testpasses (all existing tests, no regressions)./Scripts/lint.sh lintpasses (0 violations)Additional Notes to Human Reviewer
#available(macOS 26, *)branching follows the existing pattern used inCodexbarApp.swiftCo-authored-by: Claude Code noreply@anthropic.com