Dark Mode bugs in Mojave

Dark Mode seems so simple, but turns out to be a lot more complex. Every so often I turn over a fresh stone in Mojave’s otherwise excellent implementation, and discover another crab waiting to bite. Here are two recent stones which I have added to the list of bugs in Mojave 10.14.

QuickLook rendering of Rich Text

As I explained in my earlier article of today, about my renegade RTF editor DelightEd, Rich Text can be encoded so that it switches mode properly, using an expanded colour table \expandedcolortbl containing a text colour named textColor, such as
\cssrgb\c0\c0\c0\cname textColor

When macOS renders text set in that foreground colour, it is displayed in black on a white background in Light Mode, and white on a black background in Dark Mode. Although TextEdit and most editors don’t use this feature, as they keep their text views in permanent Light Mode, it works a treat in badly-behaved editors such as my DelightEd which do change the mode of their text views.

Unfortunately, the QuickLook qlgenerator in Mojave doesn’t (yet) work the same. In QuickLook Thumbnails and full previews, text marked in textColor switches between black and white, but the background doesn’t change colour, following the TextEdit convention. The result is that all text in Rich Text which is set in textColor vanishes when you switch to Dark Mode. It’s a good party trick, but not an ideal preview of a document.

Here’s an example. The first screenshot is, of course, in Light Mode. At the upper left is a Rich Text document mostly set in textColor, displayed in DelightEd. At the lower right is the document’s thumbnail in the Finder, and in the centre is the QuickLook preview shown by pressing the Space bar.


All three renderings of the document use identical colours. But when you switch that same view to Dark Mode, this is what happens:


DelightEd has switched its window to full Dark Mode, and now renders textColor content as white on black, as expected. The thumbnail retains the white background, but textColor content is now rendered in white, exactly the same as appears in the larger preview.

I hope that Apple is fixing this bug in the QuickLook RTF qlgenerator.

Dictionary popover rendering of HTML

When you select a word in some text and press Command-Control-D, macOS opens a popover which, among other things, can display a dictionary look-up of that word.

I have previously explained how Dictionary.app often doesn’t render custom dictionaries correctly in Dark Mode, and the CSS @media selector which can be used to correct this. Unfortunately Dictionary.app and this popover render custom dictionary content differently. When you use the @media selector to ensure that your custom dictionary renders properly in Dark Mode within Dictionary.app, this popover kindly renders your text in very dark grey on black, as shown below for Webster’s.


Clearly, the rendering engine being used by Dictionary.app and that used for this popover should be brought into line, so that both behave consistently and respect the @media selector which works so well in the app. I suspect that this may be a component or relation of WebKit, which apparently doesn’t yet respect the @media selector.

I don’t work in Dark Mode all the time, but for some tasks it is truly awesome. These are relatively minor bugs, and it will be even more awesome as Apple fixes these in Mojave.