In macOS versions prior to Mojave and the Dark Appearance, it was possible to draw a custom background of a NSTableView with a specific sequence of alternated rows. For instance, if you were using the standard
alternatingContentBackgroundColors
colors by retrieving the you could have the following sequences of background for rows:first color
first color
second color
first color
second color
second color
Thanks to or, more exactly, unfortunately because of the tinted material, this is apparently not possible anymore because as soon as you subclass the drawRect: method of NSTableView and use
NSRectFillUsingOperation or - [NSBezierPath fill]
you can't get the proper rendering for the rows background (the rows are not tinted).Maybe it could be possible to work around this issue by defining the entire sequence of rows background color but:
- this seems stupid for multiple reasons including the fact that in drawRect:, you only need to find out the color of the displayed rows.
- this requires to use an undocumented private API and apparently, AppKit engineers are not happy when private APIs are being used.
Question:
How can we support non periodic sequences of rows background colors (with cell-based table views) in Mojave Dark Appearance mode?