Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text and background color from Composition settings ignored in Dark mode #168

Closed
RealRaven2000 opened this issue Jan 31, 2022 · 8 comments
Closed
Assignees
Labels

Comments

@RealRaven2000
Copy link
Owner

In Thunderbird's Composition settings under HTML style the user can choose not to use the default colors of the reader but configure specific colors for text and background:

image

With SmartTemplates this setting is ignored and the composer shows bright text on dark background regardless. Expected behavior would be to transfer these colors to the new template.

@RealRaven2000 RealRaven2000 self-assigned this Jan 31, 2022
@RealRaven2000
Copy link
Owner Author

This implemented via the attributes text and bgcolor in the body element.

<body text="#000000" bgcolor="#FFFFFF">

At first glance, we could just preserve these attributes and copy them into the new body element - this may counteract any style rules that c0ouild be attached to the wanted template (imagine you have a letter paper with yellow background) so this needs to be done in a way that can still be overwritten with CSS.

@RealRaven2000
Copy link
Owner Author

Without SmartTemplates, these color attributes would probably be injected by Thunderbird after the NotifyComposeBodyReady event. In debugger I currently do not see them when SmartTemplates executes the function insertTemplate().
They are stored in global config settings under:

msgcompose.background_color
msgcompose.text_color

the easiest way would probably injecting these if the option "Use reader's default colors" is inactive. This boolean flag is stored in msgcompose.default_colors.

@RealRaven2000
Copy link
Owner Author

As part of its event handler NotifyComposeBodyReady(), Thunderbird calls the function loadHTMLMsgPrefs() to set these colors. The outer (event) function is monkey-patched by SmartTemplates and the original stored into the variable SmartTemplate4.Util.OrigNotify - which should be called at some stage during Composer startup. However, when writing new messages SmartTemplates instead uses the method NotifyComposeBodyReadyNew() - which does not call the loadHTMLMsgPrefs() function. I believe the reason for omitting the NotifyComposeBodyReady function for new mails is the extra processing on identities which is unwanted as SmartTemplates needs to do its own stuff in order to load an identity specific template.

https://searchfox.org/comm-esr91/source/mail/components/compose/content/MsgComposeCommands.js#9071

I can probably replicate the coloring code from there.

@RealRaven2000
Copy link
Owner Author

For composing new messages - I added a call to Thunderbird's internal function loadHTMLMsgPrefs() after calling NotifyComposeBodyReadyNew() . This appears to fix this issue at least for writing new mails:

smartTemplate-fx-3.10pre13.zip

to try out this version, download the zip file, the drag it (without unpacking) into Thunderbird Add-ons manager.

@RealRaven2000
Copy link
Owner Author

Fixed in 3.10.1 released on 04/Feb/2022

@mattias4000
Copy link

mattias4000 commented Jun 13, 2022

Hello.
I still had some problems. You wrote to me earlier: "If you could add the name of the theme you are using there and include a screenshot of the forward button you click (are you using Thunderbird Conversations? Which button exactly you are using is significant. Are you using external templates from the template dropdown?) it would also be very helpful"

I add some pictures below. Hope they can be helpful:

If I press reply to the email on the picture below, I get white background and white text. If I press forward, I get wrong colours - black background and black or white text.

  1. The forward buttons
    smarttemplate-1 copy
    ...
  2. The forwarded email
    smarttemplate-2 copy
    ..
  3. The theme.
    smarttemplate-3 copy

@RealRaven2000
Copy link
Owner Author

Can you force white background / black text via your forwarding template? Try to add the following lines:

<style>
  body {
    color: black;
    background-color: white;
  }
</style>

image

this is only a quick fix for the moment... but should get the job done

@mattias4000
Copy link

Hi. Adding that code makes the colors right also when forwarding. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants