2

I have NSCollectionView with custom items which contain NSTextField and NSImageView.

I realized highlight behavior of collection view items manually (ie. redefined the setSelected: method in my NSCollectionViewItem descendant class). I successfully change the background color of selected items, but I miss one small but important thing: the text color of the selected item doesn't change.

I know that the NSTableView item highlighting changes the text color along with the background color, but I cannot mimic it since I don't know the algorithm of color's change. The text color of my NSCollectionViewItems can be different. When I highlight the item in NSTableView, the gray text becomes lightgray, black becomes white and so on. Does anybody know how they do that? Maybe there's a ready solution in the Cocoa API that I missed? Please help.

DenisL
  • 51
  • 5

0 Answers0