@@ -294,9 +294,15 @@ extension StatusItemController {
294294 let brand = ProviderBrandIcon . image ( for: primaryProvider)
295295 {
296296 let displayText = self . menuBarDisplayText ( for: primaryProvider, snapshot: snapshot)
297- self . setButtonImage ( brand, for: button)
297+ if #available( macOS 26 , * ) {
298+ let tinted = Self . tintedBrandImage ( brand, color: usageColor)
299+ self . setButtonImage ( tinted, for: button)
300+ self . setButtonTintColor ( nil , for: button)
301+ } else {
302+ self . setButtonImage ( brand, for: button)
303+ self . setButtonTintColor ( usageColor, for: button)
304+ }
298305 self . setButtonTitle ( displayText, for: button)
299- self . setButtonTintColor ( usageColor, for: button)
300306 return
301307 }
302308
@@ -326,18 +332,34 @@ extension StatusItemController {
326332 self . setButtonImage ( image, for: button)
327333 self . setButtonTintColor ( nil , for: button)
328334 } else {
329- let image = IconRenderer . makeIcon (
330- primaryRemaining: primary,
331- weeklyRemaining: weekly,
332- creditsRemaining: credits,
333- stale: stale,
334- style: style,
335- blink: blink,
336- wiggle: wiggle,
337- tilt: tilt,
338- statusIndicator: statusIndicator)
339- self . setButtonImage ( image, for: button)
340- self . setButtonTintColor ( usageColor, for: button)
335+ if #available( macOS 26 , * ) {
336+ let image = IconRenderer . makeIcon (
337+ primaryRemaining: primary,
338+ weeklyRemaining: weekly,
339+ creditsRemaining: credits,
340+ stale: stale,
341+ style: style,
342+ blink: blink,
343+ wiggle: wiggle,
344+ tilt: tilt,
345+ statusIndicator: statusIndicator,
346+ tintColor: usageColor)
347+ self . setButtonImage ( image, for: button)
348+ self . setButtonTintColor ( nil , for: button)
349+ } else {
350+ let image = IconRenderer . makeIcon (
351+ primaryRemaining: primary,
352+ weeklyRemaining: weekly,
353+ creditsRemaining: credits,
354+ stale: stale,
355+ style: style,
356+ blink: blink,
357+ wiggle: wiggle,
358+ tilt: tilt,
359+ statusIndicator: statusIndicator)
360+ self . setButtonImage ( image, for: button)
361+ self . setButtonTintColor ( usageColor, for: button)
362+ }
341363 }
342364 }
343365
@@ -359,9 +381,15 @@ extension StatusItemController {
359381 let brand = ProviderBrandIcon . image ( for: provider)
360382 {
361383 let displayText = self . menuBarDisplayText ( for: provider, snapshot: snapshot)
362- self . setButtonImage ( brand, for: button)
384+ if #available( macOS 26 , * ) {
385+ let tinted = Self . tintedBrandImage ( brand, color: usageColor)
386+ self . setButtonImage ( tinted, for: button)
387+ self . setButtonTintColor ( nil , for: button)
388+ } else {
389+ self . setButtonImage ( brand, for: button)
390+ self . setButtonTintColor ( usageColor, for: button)
391+ }
363392 self . setButtonTitle ( displayText, for: button)
364- self . setButtonTintColor ( usageColor, for: button)
365393 return
366394 }
367395
@@ -448,18 +476,34 @@ extension StatusItemController {
448476 self . setButtonTintColor ( nil , for: button)
449477 } else {
450478 self . setButtonTitle ( nil , for: button)
451- let image = IconRenderer . makeIcon (
452- primaryRemaining: primary,
453- weeklyRemaining: weekly,
454- creditsRemaining: credits,
455- stale: stale,
456- style: style,
457- blink: blink,
458- wiggle: wiggle,
459- tilt: tilt,
460- statusIndicator: self . store. statusIndicator ( for: provider) )
461- self . setButtonImage ( image, for: button)
462- self . setButtonTintColor ( usageColor, for: button)
479+ if #available( macOS 26 , * ) {
480+ let image = IconRenderer . makeIcon (
481+ primaryRemaining: primary,
482+ weeklyRemaining: weekly,
483+ creditsRemaining: credits,
484+ stale: stale,
485+ style: style,
486+ blink: blink,
487+ wiggle: wiggle,
488+ tilt: tilt,
489+ statusIndicator: self . store. statusIndicator ( for: provider) ,
490+ tintColor: usageColor)
491+ self . setButtonImage ( image, for: button)
492+ self . setButtonTintColor ( nil , for: button)
493+ } else {
494+ let image = IconRenderer . makeIcon (
495+ primaryRemaining: primary,
496+ weeklyRemaining: weekly,
497+ creditsRemaining: credits,
498+ stale: stale,
499+ style: style,
500+ blink: blink,
501+ wiggle: wiggle,
502+ tilt: tilt,
503+ statusIndicator: self . store. statusIndicator ( for: provider) )
504+ self . setButtonImage ( image, for: button)
505+ self . setButtonTintColor ( usageColor, for: button)
506+ }
463507 }
464508 }
465509
@@ -670,19 +714,37 @@ extension StatusItemController {
670714 {
671715 guard statusIndicator. hasIssue else { return brand }
672716
673- let image = NSImage ( size: brand. size)
674- image . lockFocus ( )
675- brand . draw (
676- at : . zero ,
677- from : NSRect ( origin : . zero , size : brand . size ) ,
678- operation : . sourceOver ,
679- fraction : 1.0 )
680- Self . drawBrandStatusOverlay ( indicator : statusIndicator , size : brand . size )
681- image . unlockFocus ( )
717+ let image = NSImage ( size: brand. size, flipped : false ) { rect in
718+ brand . draw (
719+ at : . zero ,
720+ from : rect ,
721+ operation : . sourceOver ,
722+ fraction : 1.0 )
723+ Self . drawBrandStatusOverlay ( indicator : statusIndicator , size : brand . size )
724+ return true
725+ }
682726 image. isTemplate = brand. isTemplate
683727 return image
684728 }
685729
730+ /// Composites a tint color onto a brand image using sourceIn blending, producing a non-template image
731+ /// suitable for macOS 26 Liquid Glass where `contentTintColor` is ignored on template images.
732+ nonisolated static func tintedBrandImage( _ brand: NSImage , color: NSColor ? ) -> NSImage {
733+ guard let color else { return brand }
734+ let image = NSImage ( size: brand. size, flipped: false ) { rect in
735+ brand. draw ( in: rect, from: rect, operation: . sourceOver, fraction: 1.0 )
736+ guard let ctx = NSGraphicsContext . current? . cgContext else { return true }
737+ ctx. saveGState ( )
738+ ctx. setBlendMode ( . sourceIn)
739+ color. setFill ( )
740+ ctx. fill ( rect)
741+ ctx. restoreGState ( )
742+ return true
743+ }
744+ image. isTemplate = false
745+ return image
746+ }
747+
686748 private nonisolated static func drawBrandStatusOverlay( indicator: ProviderStatusIndicator , size: NSSize ) {
687749 guard indicator. hasIssue else { return }
688750
0 commit comments