luckymarmot/ThemeKit

NSTableView challenges

rdmeyers opened this issue · 4 comments

Let me start by saying your ThemeKit is brilliant! You have made it so simple to implement, and yet so flexible. I am hoping that flexibility will accommodate the problem I am having with the NSTableView class (or some child within it). A picture is worth a 1000 words, so here we go:

image

Is there any way to keep the cells from being themed? The table itself is theming just fine as the dark theme will attest to. It seems that maybe the NSTextFields in the tableview are getting themed and I would like to see those ignored. I have tried the following in various forms and combinations to no avail, even attempting to skip theming the tableview completely:

[[TKThemeManager sharedManager] setTheme:TKThemeManager.lightTheme];
[TKThemeManager sharedManager].windowThemePolicy = TKThemeManagerWindowThemePolicyDoNotThemeSomeWindows;
[TKThemeManager sharedManager].notThemableWindowClasses = @[[NSTableView class]];

Any suggestions would be greatly appreciated.

By the way, the default dark theme looks even better on Mohave than High Sierra, etc. :-)

Thanks for the feedback!
This is a similar issue to this one. Basically, that relates to the allowVibrancy property of either NSTableView, its parent view or its child cell views (child views inherits vibrancy from its parents). So, I would recommend playing with it. If you have a sample project where you can reproduce the issue I can give a look and give it a try as well!

I have spent the morning trying to isolate the issue. I made a couple of small projects and could not replicate my problem in simple views and windows, so it seems that the issue manifests itself when the tableview is presented on a Sheet. Do you have any thoughts on that? I have no access to the vibrancy attribute that I can see.

@rdmeyers , I will make some experiments and will let you know!

Good news @rdmeyers ,

I have just been able to reproduce the issue! The theming issue only seems to affect view-based NSTableViews, when placed on sheets.

The way to fix this is to make sure any NSTableCellView subview has allowsVibrancy set to false. Please check the attached sample project where this is demonstrated. On the view-based table, you will see that the first column is fixed, as I replaced NSTextField by FixedTextField which only overrides allowsVibrancy to set it to false :)

This should help fix your issue!

Sample Project: Issue18.zip
PS: Don't forget to run pod install before opening the Issue17.xcworkspace file!