Dark Mode Inversion Issue: Custom Dark Hex Colors (#111827) Render Illegible on Dark Background

Title: Dark Mode Inversion Issue: Custom Dark Hex Colors (#111827) Render Illegible on Dark Background

Body:

Description

I encounter a rendering issue when using Mailspring in Dark Mode. When an HTML email (specifically an email signature) uses specific dark hex codes for text (e.g.,

#111827

, a very dark grey), Mailspring’s dark mode engine fails to invert the lightness of these colors effectively.

Instead of flipping the dark text to a light color (as it does with standard black), it seems to treat it as a “colored” element and creates a low-contrast dark-blue-on-dark-grey result, rendering the text nearly invisible.

Steps to Reproduce

  1. Enable Dark Mode in Mailspring.

  2. Receive or Compose an email containing HTML with text styled as

    color: #111827;
    

    (or similar dark charcoals).

  3. Observe the rendering.

Expected Behavior

Modern dark mode algorithms (like those in WebKit or other mail clients) typically detect when a text color’s luminosity is too close to the dark background and invert it to a high-contrast light shade (e.g., shifting

#111827

to a soft white or light grey).

Actual Behavior

The background turns dark grey, but the text remains very dark (appearing as a low-visibility dark blue/black), making it illegible against the dark background.

Environment

  • OS: Linux / Mac

  • Mailspring Version: (Insert your version here, e.g., 1.13.3)

Technical Suggestion

The issue appears to be that the inversion algorithm is too conservative with “colored” pixels. Dark Greys like

#111827

are technically colors (Blue-Grey), which might be bypassing the standard “Black-to-White” inversion. Adjusting the threshold for what constitutes “black text” or forcing a minimum contrast ratio against the background would solve this.