App Store Style NSTableView (source list with a neutral highlight color)

I'm trying to get a similar look to the sidebar table view in redesigned Mac App Store app on 10.14. That nice sidebar seems to have the standard source list appearance (with vibrancy), but unlike regular table views, a selected row has a neutral colored vibrant selection, rather than coloring the row's background with the system control accent color.


Can anyone give a suggestion on how to get this behaviour?


Thanks very much.

Replies

A way to get the same result:


- in IB, set the color of the background of the view of your tableView to a custom gray 92% (very clear)

- set the background color of the tableView cell view to the same value


Add this in your controller to force text to remain black when highlighted

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if let cellAtRow = tableView.cellForRow(at: indexPath) {
            cellAtRow.textLabel?.highlightedTextColor = .black
        }
    }


That should do it.

Thanks Claude31, though I don't think this will do it.


I'm using NSTableView in AppKit (not UITableView), and I want to retain vibrancy, which conflicts with setting background colors on the table.


I need a way to override the tableView's selection colour somehow to prevent it drawing in the standard accent color, and instead draw in a vibrant gray.