mail icon indicating copy to clipboard operation
mail copied to clipboard

Figure out how to deal with dark mode

Open danirabbit opened this issue 5 years ago • 6 comments

Screenshot from 2020-06-22 12 17 22@2x

For plain text mails we can probably provide a dark default stylesheet

For HTML mails is this acceptable or should we keep the whole sheet light or?

danirabbit avatar Jun 22 '20 19:06 danirabbit

Gmail appears to try to intelligently change the contents, but frequently breaks with images. I recall macOS also tries to do something smart, but I'm not sure. The problem I see is a lot of "plain text" emails from users are probably actually HTML… and who knows if their client is inserting dark-style-friendly CSS or not. (That reminds me, we should ensure we're inserting that CSS in outgoing emails, filing as a separate issue…)

cassidyjames avatar Jun 22 '20 22:06 cassidyjames

From what I can find (and confirming on a Mac), macOS Mail doesn't do anything for rich emails like this, and I guess it would be up to the sender to include CSS for prefers-color-scheme. In that case, WebKitGTK will do the right thing, too.

For plaintext, Apple Mail defaults to dark as well, but has a toggle in the preferences to make mail contents always light—I don't think that's necessary. It appears Apple Mail also will automatically inject its own CSS into rich HTML email if there are no images—I’m not sure about custom colors, though.

Gmail tries to automatically inject styles into most emails, with varying results:

Screenshot_20200622-163131

cassidyjames avatar Jun 22 '20 22:06 cassidyjames

Just throwing an idea: for a light HTML email which doesn't come with dark style CSS, can we apply a translucent black overlay on top of the content?

That way, we don't blind the user while still respecting the sender's intended styles.

There's limited wiggle room of course. Can't make it so opaque that it starts violating AAA for black or dark gray text on white.

We could determine the “lightness” of the content by looking at the dominant colours, like we do for determining Wingpanel colours. (Does WebKit let you do that?)

dar5hak avatar Jan 26 '21 21:01 dar5hak

@dar5hak the more I think about it, trying to inject/modify styles for rich email is probably a bad idea; just like the web browser doesn't inject styles to make web pages dark, I don't think we should here. We should definitely address #494 so we're being good email citizens, and if it works, we should loudly encourage email senders to include dark styles in their rich emails. But then it's up to senders to do the right thing. :shrug:

cassidyjames avatar Jan 27 '21 18:01 cassidyjames

Hmm yes, when you draw a parallel to browsers, it makes sense. There are going to be growth pains till a critical mass of senders start shipping a dark style, but it is the right way to go.

dar5hak avatar Jan 28 '21 03:01 dar5hak

https://github.com/yourtempo/tempo-message-dark-mode

parnoldx avatar Oct 25 '21 19:10 parnoldx