I have a TextArea that displays text that can be styled for printing on a PDF. As the styling includes setting the text colour I’d like to show the TextArea with black text and a white BG even when a macOS app is in dark mode. I can do this partly by calling the following code from App.AppearanceChanged:
TextArea1.BackColor = &cFFFEFE00
TextArea1.TextColor = &c00000000
However then the colour of the cursor and selected text isn’t correct. Is there a way to override the Dark/Light mode on a control basis?
You could use NSTextView methods via MBS Plugin or declares to change the colors directly.
Thanks Christian as always… Anyone else wanting to do this here’s some code that uses the MBS plugins:
dim n as NSTextViewMBS = TextArea1.NSTextViewMBS
n.backgroundColor = NSColorMBS.whiteColor
n.textColor = NSColorMBS.blackColor
n.insertionPointColor = NSColorMBS.blackColor
You could also probably just set the appearance of that field or view… which is what Apple suggests. The reason for this is that in Mojave, nothing is a solid color any more. For instance, You may find that using The settings above makes the field stand out a little bit in light mode.
Time to start the “Bring back Tiger” campaign! Everything did what it should - and more importantly, what Apple had documented and you expected.