Dark Theme on Message Optional/Poor text rendering in dark theme


When using the dark theme, text in emails is less legible. Something is ‘off’ with the font smoothing for the text that makes it look worse than the light mode version. The text in the UI is fine; it’s just text in the email itself that has the issue.

See screenshot of light mode: https://d.sb/2021/03/mailspring_01-13.24.59.png vs the same email in dark mode: https://d.sb/2021/03/mailspring_01-13.25.30.png. Compare the text directly above the “Go to Node” button in the email vs the UI text (subject line / sender / recipient) at the top of the screenshot.

To Reproduce…

Steps to reproduce the behavior:

  1. Use Windows
  2. Switch to dark mode theme
  3. View an email

Expected Behavior

Nice font rendering


Linked above


  • OS and Version: Windows 10, version 20H2
    • Installation Method: Windows Installer
  • Mailspring Version: 1.8.0

It looks like this is caused by the invert + hue rotation filter . If I use the devtools to remove the filter: invert(100%) hue-rotate(180deg) filter from the body within the iframe, it fixes the text rendering.

Of course, that means the email is no longer displayed in “dark mode”, but I’d be content with a dark UI + light email content, unless there’s a proper fix that’s easier.

There seem to be several problems with email rendering on dark themes:

I think we need to reconsider dark mode on emails, or else make it a separate option.

Yeah, a separate option would be good.

I don’t think CSS alone is sufficient for a good working implementation of dark mode emails… There’s just too many edge cases. The new Facebook redesign uses a similar approach for “fake dark mode” on legacy pages that haven’t been migrated to the new framework yet, and it has similar issues with text rendering, and scroll performance isn’t as good as it should be.

I think a working implementation of “automatic dark mode” for emails would need to actually walk the DOM, read the background and text colours of each element using getComputedStyle, and modify the CSS, flipping the colours where needed. That could also solve the issue of dark text on a dark background as the code could measure the contrast ratio and flip the colour of the text based on the background colour.

If you have any Javascript or Typescript skills, you’d be welcome to dig into Mailspring’s source code and implement an option in the Appearance settings for separately toggling Dark Emails. It’d make an excellent stop-gap for the ongoing problems we’re having with this feature, and besides, not everyone wants dark-mode emails to go with the dark-mode interface. I think that PR would be very likely to get accepted.

For reference, here’s a screenshot of how the same email looks in dark mode in a different app (eM Client): https://d.sb/2021/03/MailClient_01-18.25.27.png. The rendering is fine there.

I’ve got JavaScript/TypeScript skills, I’ll just have to find the time to look into it. I’m usually pretty busy so can’t promise anything, but maybe I’ll get around to it :smiley:

1 Like

I’m merging this effective duplicate in:

Good idea for some mails. But I love the dark theme for read mail (this works great for me for the majority of emails). A good option should be a button close to mail to set it temporarily in light mode. This is done on some mail clients for android, and solves the problem that dark theme can have sometimes on mail contents. Better idea than a config in preferences view which make switch between light/dark on mail content only.

I hope you understand my idea, unless my english is not perfect :slight_smile:

I’m still interested in fixing this by improving how the dark mode works (and maybe adding a toggle to switch between dark and light mode just for the email content), but Mailspring is very unstable for me and I get errors basically every day I try to use it (Lots of errors after archiving a large number of emails), so I’m not really using it any more and thus haven’t really gotten around to working on this yet.