1

I have a simple status bar app using NSPopover that I'd like to support Mojave Dark Mode. If I use the recommended semantic colors it looks fine in most cases light and dark, unless there's a bright window behind it, in which case the window transparency makes everything look washed out and the one image looks horrible. It looks great if I turn on the system prefs "Reduce transparency". Is there any way to get the no-transparency mode on a per-view basis? I've looked at the vibrancy and alphaValue properties with no success.

I know I can use hard-coded colors for everything and detect dark mode programmatically, but that's exactly the design I'm trying to get away from in switching to semantic colors. I suspect if you're going with the OS theme then you take what you get, I just don't like the OS's choice in this case.

Eric McNeill
  • 1,784
  • 1
  • 18
  • 29
  • I think you should check the second answer to this [question](https://stackoverflow.com/questions/19978620/how-to-change-nspopover-background-color-include-triangle-part/30660945#30660945). – jvarela Oct 29 '18 at 23:55
  • @jvarela That's exactly what I'm doing today, with a white background. I think my solution will be to stick with the current technique but instead of white use hard-coded light or dark mode colors matching those the OS uses when "Reduce transparency" is on. I love the idea of semantic colors, but if the UI is going to morph so drastically that's not an option right now. – Eric McNeill Oct 31 '18 at 15:21
  • Hard-coded colors are often not a good idea. If you are targeting 10.13 or later, you can define a color set using .xcassets. In this way, you only need to refer to that color and the UI will choose the right color under light or dark mode. That's what I did when I converted my app to dark mode. – jvarela Oct 31 '18 at 22:07

0 Answers0