David Dworkin
David Dworkin

Reputation: 21

In Table view, how do I customize the background color of a selected row?

I'm making a macOS app using SwiftUI. I have a Table view. I have selection enabled but I can't find any way to customize the selection color - it's always blue.

My table looks something like this:

Table(of: MyObj.self, selection: $selectedID, sortOrder: $sortOrder) {
        TableColumn("Column Name") { obj in
            // do some custom view
        }
        // ...
    } rows: {
        Foreach (model.items) { obj in
            TableRow(obj)
        }
    }
}

The selection color is always the royal blue color. This doesn't match with colors in my app, and colors of text and icons in the row don't look good against this blue color.

Upvotes: 1

Views: 596

Answers (1)

lorem ipsum
lorem ipsum

Reputation: 29632

You can change the "AccentColor" in "Assets" to override the default Apple systemBlue accent color everywhere in your app.

Upvotes: 1

Related Questions