Open Bug 1708974 Opened 4 years ago Updated 3 years ago

Thunderbird does not report background color appropriately when dark theme is used

Categories

(Thunderbird :: Message Compose Window, defect)

defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: tobias.bora, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dupeme)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0

Steps to reproduce:

In KDE settings, setup the "Breeze dark" theme:

  1. Global theme: "Brise sombre" (translation may be like "Breeze dark")
  2. Plasma style: "Breeze sombre"
  3. Colors: "Brise sombre"
  4. Icons: "Breeze sombre"

You may need to restart Thunderbird to ensure changes are taken into account.

Then, you should see that when writting emails, your text is white and your background is dark. This is great, except that some plugins like "LatexIt" need to obtain the text color to appropriately add LaTeX images.

Actual results:

When using a plugin like "LatexIt", the text color that is reported is the color of the "themed" version, not the one of the final, sent email. Therefore, when writing an email via LatexIt, the math text is written in white on dark theme: the problem is that when sending the email, the background will be turned back into white, making any equation unreadiable.

You can find some screenshots here: https://github.com/protz/LatexIt/issues/61#issuecomment-821852988

Expected results:

I'd expect LatexIt to obtain the color of the text in the final email.

Ideally, one could imagine two ways to obtain the current color, one with the color in the final email, and one with the color in the current (themed) window.

I'd also love to be able to disable temporarily the theme on a single textarea (with a right-click for instance) to properly render this kind of emails, but I'm not sure if Thunderbird can do it or if a report must be done to KDE instead.

(actually, when changing the KDE theme, you may need to logout/login again).

Keywords: dupeme

The "LaTeX It!" extension is not compatible with Thunderbird 78.

What Linux distribution, or have you tested them all with the KDE desktop?

Flags: needinfo?(tobias.bora)

Can I chirp in here?

You are absolutely right, that the main branch of LatexIt! is not compatible with TB78, but the "mailextension" branch is (sort of, thanks to the great work by jobisoft!)

The discussion about the colour issue starts with this post: https://github.com/protz/LatexIt/issues/61#issuecomment-821852988

It's me, who wrote that part dealing with the colour. The idea is, that by default you want the colour of the equation to be the same as that of the text. Here is, how I achieved this:

  1. Get the colour of the surrounding text.
  2. Generate the png image showing the equation with this colour as foreground colour and a transparent background.

This is the line getting the font colour (https://github.com/protz/LatexIt/blob/b2b62ce0b4e20eecac8f92930e899b105f56e777/content/main.js#L518):
var font_color = window.getComputedStyle(elt.parentElement, null).getPropertyValue('color')

It looks like it gets the colour of the themed text and not the color of the text how it will be finally sent.

A sidenote: If LatexIt! were able to get the colour of the text how it is sent, there is the possibility, that this is black. The equations then would be shown black on a dark background … That said, it will then be the writer (and not the reader), who has to deal with the problem of illegible equations!

Concerning the branch, see indeed the comment of s.p.helma.

Concerning the OS I tested this, it is NixOs unstable (more precisely 21.03pre250162.34ad166a830).

Flags: needinfo?(tobias.bora)

And concerning your sidenote s.p.helma: to make the equations readible for both the writer and the reader, it could be handy to put a background color to the generated picture that defaults to the one of the final email, that way the equation is readable irrespective of the background color.

Sorry Tobias, I can understand your thinking, but "hard coding" the background into the image might not be such a good idea as it looks in the first place: You have finished your email with all equations. Then you decide that you want to change the background, either of the whole email or to highlight a section. Now you would have equations showing the old background and not the new one. That's the reason, why the transparent background was implemented in the first place!

The best way would be to use a .svg file, which can be themed (https://css-tricks.com/using-svg/#now-you-can-control-with-css). I had this discussion with the creator of LatexIt! and we decided not to use .svg files, because there are some big players not supporting them in HTML emails.

Well I don't think that many people change their background color after writing the emails when writing math, and even if they do they can still click on "LaTeX It! > Undo all" and regenerate again the equations. After, putting a background color or not could be an option in LaTeX It!, that way people could just use what they prefer.

Sorry again, Tobias, if you had read the man page for dvipng, you would know, what to do. dvipng is the program to generate the image, which is included, and it is called with the option -bg 'Transparent'.

The man page states:

       -bg color_spec
           Choose background color for the images. This option will be ignored
           if there is a background color \special in the DVI. […]

So you only have to write a latex template, which puts the colour you want as background as a background color \special into the DVI file and you will get your solid background (and not the default transparent background).

Please pardon my ignorance, but I have no idea how LatexIt! works internally, and I'm not an expert of DVI files at all. Would you please be kind enough to write a full minimal working template that adds a background color? When reading this documentation I understand that I should write something like \special{background color rgb 0.0 1.0 1.0}, but it does not work. I tried many different forms (more or less fantasist), they all fail:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[active,displaymath,textmath]{preview} % DO NOT DELETE - this is required for baseline alignment
\pagestyle{empty}
\usepackage{xcolor}
\begin{document}
\everymath{\color{black}}
%\special{background rgb 0.0 1.0 1.0}
%\special{rgb 0.0 1.0 1.0}
%\special{background color white}
\special{background color rgb 0.0 1.0 1.0}
%\special{background color 0 0.87 0.68 0.32 setcmykcolor}
%\everymath{\special{background color 0 0.87 0.68 0.32 setcmykcolor}}
%\everymath{\special{background color .5 .85 .4 .2}}
%\special background color rgb 0.0 1.0 1.0
%\everymath{\special{background color rgb 0.0 1.0 1.0}}
%background color \special
%background color rgb 0.0 1.0 1.0 \special
%\pagecolor{white}
$\Delta$ % this is where your LaTeX expression goes between $$
\end{document}

I'm sorry if this is trivial for you, but not all of us have your skills.

Sorry, Tobias, this is not a LaTeX/DVI/dvipng support forum, but a bug tracker for Thunderbird. You might be better off to ask that question at a site dedicated to LaTeX. (And no, I don't know the answer from the top of my head myself …) If they tell you, you need a special command line parameter, please open a new issue at the LatexIt issue tracker. Thanks.

Ok I understand, but your comment "if you had read the man page" lead me to believe that you had a simple solution. Nevermind, thanks for the help.

You need to log in before you can comment on or make changes to this bug.