fix: underline links in mail shown in the app's colours so button links stay recognisable

This commit is contained in:
Linus Rath
2026-10-29 17:53:59 +01:00
parent a982c3f235
commit da215b8c06
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -120,6 +120,7 @@ describe('mailOverrideCss', () => {
expect(css).toContain('font-family:"Lexend", sans-serif!important;font-size:calc(0.875rem * 1.25)!important');
expect(css).toMatch(/body \*:not\([^)]*\)\{font-family:inherit!important;font-size:1em!important[^}]*color:#111111!important;background-color:transparent!important;background-image:none!important/);
expect(css).toContain('a[href],a[href] *{color:#1d4ed8!important}');
expect(css).toContain('a[href]{text-decoration-line:underline!important}');
expect(css).not.toContain('letter-spacing');
});
+3
View File
@@ -206,7 +206,10 @@ export function mailOverrideCss(o: MailOverride): string {
`${text}{font-family:inherit!important;font-size:1em!important;line-height:inherit!important;color:${fg}!important;background-color:transparent!important;background-image:none!important;text-shadow:none!important}`,
'h1{font-size:1.6em!important}h2{font-size:1.4em!important}h3{font-size:1.2em!important}h4,h5,h6{font-size:1.05em!important}',
o.minPx > 0 ? `small,sub,sup{font-size:max(0.85em,${o.minPx}px)!important}` : 'small,sub,sup{font-size:0.85em!important}',
// Underlined too: with the backgrounds gone, a link drawn as a button
// would otherwise look like plain text.
`a[href],a[href] *{color:${link}!important}`,
'a[href]{text-decoration-line:underline!important}',
// Never justified (the text pass catches justify from <style> rules).
'[align="justify"],[style*="justify"]{text-align:start!important}',
];