Skip to content

Commit

Permalink
highlightTableViewSelection: Always use default selection color if no…
Browse files Browse the repository at this point in the history
…t set. (#253)

The current implementation will attempt to assign a default value for selectionColor if backgroundColor is white.  There's two issues with that:

1. `backgroundColor` is likely in the `NSNamedColorSpace`,  whereas it is being compared to `[NSColor whiteColor]`, which is in the `NSCalibratedWhiteColorSpace`. That comparision will always return false.
2. Users will probably expect the selected item to be highlighted in a different color even if the background color is not white.  For example, the consider a scenario where the default background color is white, and the alternate background color is grey.  It makes sense to always highlight the selected row in blue.  This aligns with the behavior when `highlightedTableRowBackgroundColor` is defined.
  • Loading branch information
qmfrederik authored Apr 3, 2024
1 parent f46accf commit 059d13f
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions Source/GSThemeDrawing.m
Original file line number Diff line number Diff line change
Expand Up @@ -3310,18 +3310,10 @@ - (void) highlightTableViewSelectionInClipRect: (NSRect)clipRect

if (selectionColor == nil)
{
// Switch to the alternate color of the backgroundColor is white.
if([backgroundColor isEqual: [NSColor whiteColor]])
{
selectionColor = [NSColor colorWithCalibratedRed: 0.86
green: 0.92
blue: 0.99
alpha: 1.0];
}
else
{
selectionColor = [NSColor whiteColor];
}
selectionColor = [NSColor colorWithCalibratedRed: 0.86
green: 0.92
blue: 0.99
alpha: 1.0];
}
[selectionColor set];
}
Expand Down

0 comments on commit 059d13f

Please sign in to comment.