File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -462,10 +462,21 @@ extension TerminalView {
462462 return nativeBackgroundColor
463463 }
464464 case . defaultInvertedColor:
465+ // Reverse video *swaps* the default pair, it does not invert its RGB. Inverting
466+ // produced the expected pixels only for a pure black/white pair; with any other
467+ // palette it produced a color that belongs to neither side (inverting Solarized's
468+ // base03 background yields a pink block), and over a translucent background it
469+ // produced an unreadable highlight: the block inherited the background's alpha and
470+ // vanished, leaving text painted in the inverse of the foreground over whatever the
471+ // window showed through.
472+ //
473+ // The swapped colors are forced opaque, the way Terminal.app draws reverse video
474+ // over a translucent background: the highlight is the one thing that must stay
475+ // readable at any `backgroundOpacity`.
465476 if isFg {
466- return nativeForegroundColor . inverseColor ( )
477+ return nativeBackgroundColor . withAlphaComponent ( 1 )
467478 } else {
468- return nativeBackgroundColor . inverseColor ( )
479+ return nativeForegroundColor . withAlphaComponent ( 1 )
469480 }
470481 case . ansi256( let ansi) :
471482 var midx : Int
You can’t perform that action at this time.
0 commit comments