DelightEd edges forward towards full release

In view of the recent interest in my little Rich Text editor DelightEd, I thought that I would spend a little of yesterday bringing it a bit closer to release. I have been looking at two main issues: giving it a more flexible appearance so that it isn’t as high contrast when in Dark Mode, and helping those who use it to generate Rich Text which works well in both Light and Dark Modes.

Logically, easing back the contrast would involve greying its white text a little, and lightening its near-black background a bit too. It now offers a Less Dark option in the Window menu which does the latter. However, changing the text colour has proved a bit more complex.

DelightEd works so well in Dark Mode, where other editors like TextEdit fear to tread, because it uses a predefined textColor as standard. This is part of the package of features which makes up an appearance mode – of which Mojave has two, Light and Dark. That colour is critical; if you make it a light grey, it can’t be textColor but has to be something else. Although DelightEd can render that differently in the two modes, that won’t work anywhere else.

So at present I can’t see a sound way to take the edge off the white text used in Dark Mode. Nevertheless, I hope that the lighter background grey, which I have stolen from windows, is a bit easier on the eyes.

I have had several ideas for how to help those wanting to generate truly bi-modal text, for example from imported Rich Text files. One was to show the user the colour tables at the start of the RTF code, so that you can check whether they comply with those needed for compatibility with both appearance modes. However, the colour tables can be perfectly correct, it’s more a question of whether the text is set in the correct colour. Besides, tools for hand crafting RTF aren’t going to help most users.

So I thought that a better idea would be to scan through the content and replace all black foreground colour with the magic textColor. That is what I have spent most of the day working on, because no matter what I try, whenever I change the colour of a section of Rich Text (NSMutableAttributedString), it automagically changes the font and more as well. I’m not sure whether this is a bug, or just an ‘undocumented side effect’.

This new version of DelightEd therefore has two new commands: Endarken and Enlighten, both of which perform global changes in text colour throughout the open document.

Endarken is intended for use when you have text which isn’t displaying properly, typically in Dark Mode showing as black on dark grey. This converts it all, lock, stock and barrel, to textColor, which should work fine. The perversity here, of course, is that Endarken actually bleaches your black text.

Enlighten goes in the opposite direction: it takes text which is set in textColor and all other colours and fixes it in pure black, for display in permanently light editing environments.

Neither currently has an Undo command, and both currently change the font settings, etc., to those at the start of the text.

They also won’t always work. To do this, DelightEd works through all the foreground colour settings in the text, changing them one by one. Rich Text can also quite legally include text which has no colour setting at all, but under current conventions that isn’t displayed in textColor, which has always struck me as an odd decision on the part of Apple. In that case, the simple trick is to select all the text and change it to white or black, then use Endarken or Enlighten as appropriate.

Note that you can’t do what Endarken does by hand: selecting all the text and setting it to white does not change it to textColor at all, but Endarken does both.

DelightEd version 1.0b5 is now available from here: DelightEd10b5
and from Downloads above.

Now is the first call for any further features you might want for the first full release of DelightEd, please. I’d also appreciate comments about whether it needs a Help book, or just a short note (in Rich Text, of course) explaining its quirks.