Search code examples
htmlcsshtml-email

Background color in email signature on mac mail


I'm trying to code an email signature An clients like thunderbird, outlook, gmail it works as intended but on mac mail there is a problem with color codes.

Any background-color or background or even bgcolor="" (6 hex, 3hex, rgb, doesn't matter) that i set is changed to some different color for example:
#121d52 is changed to #c2cbf7
#b8e9fd is changed to #396070

How to force it to not changing this color?


Solution

  • The problem was in dark-mode when I have switched to light-mode everything was perfect again.

    to enable dark/light mode detection in email client I had to add those meta tags

    <meta name="color-scheme" content="light dark">
    <meta name="supported-color-schemes" content="light dark">
    

    and then in css I had to force those color in dark-mode

    @media (prefers-color-scheme: dark) {
        /* ... */
    }