Colors in Email Design: Formats, Configuration Methods, and Display Peculiarities
How to set colors when crafting emails? Which color formats are used? How are transparency and gradients configured? And what rendering differences you might encounter in dark mode? Read this article to find out.
How Colors Are Specified in Emails
In modern email coding, colors are managed using CSS properties such as:
color— for text color;background-color— for the background;border-color— for an element's border.
For example, the markup for a table cell with a blue background and white text would look like this:
1 2 3<td style="background-color: #283AF9;"> <span style="color: #FFFFFF;">Text</span> </td>
To ensure that colors are displayed correctly across different email clients, CSS properties are commonly duplicated using HTML attributes, such as bgcolor for the background of a table or table cell, bordercolor for table borders, and so on:
1 2 3<td bgcolor="#283AF9" style="background-color: #283AF9;"> … </td>
In the example above, the cell's background color is defined using both background-color property and the bgcolor attribute. This means that if an email client does not support the CSS property, it can use the HTML attribute instead.
Which Color Formats Are Used in Emails

One of the most common and widely supported ways to specify colors is HEX. Its notation consists of the # symbol followed by six hexadecimal characters, with two characters ranging from 00 to FF for each color component (red, green, and blue):
color: #FF0000
A shorthand notation is also available: if both characters in each pair are identical, the notation can be shortened to three characters (for example, #F00).
HEXA adds transparency to a color. The "A" here stands for the alpha channel, which consists of two characters with values ranging from 00 (fully transparent) to FF (fully opaque). For example, 88 corresponds to approximately 53% opacity:
background-color: #FF000088
In addition to HEX(A), the RGB(A) and HSL formats can also be used to define colors in emails:
- RGB (Red, Green, Blue) uses the same color components as HEX, but their values are expressed as comma-separated decimal numbers ranging from 0 to 255.
- HSL defines a color using three characteristics: Hue, where 0° corresponds to red, 120° to green, and 240° to blue; Saturation, which determines color intensity as a percentage; and Lightness, which indicates how dark or light a color is on a scale from 0 to 100%.
For example, red (#FF0000 in HEX) is expressed as rgb(255, 0, 0) in RGB and hsl(0, 100%, 50%) in HSL.
RGB and HSL can also include alpha channels with values ranging from 0 to 1. For example, 0.5 corresponds to 50% opacity:
RGBA: rgba(255, 0, 0, 0.5)
HSLA: hsla(240, 100%, 50%, 0.5)
However, if an email client does not recognize the format, it may ignore the background color altogether. Therefore, it is worth specifying a fallback color:
background-color: #FF8080;
background-color: rgba(255, 0, 0, 0.5);
In this example, an email client that supports RGBA will apply the second value, making the background semi-transparent. Otherwise, the first, opaque color will be retained.
The table below shows color format compatibility and limitations across different email clients. The most universally supported color format for HTML emails is six-digit HEX notation. We therefore recommend using it for maximum compatibility:
| Mail.ru | Yandex Mail | Gmail | Outlook for Windows | Outlook (Web, Android, iOS) | Yahoo Mail | |
|---|---|---|---|---|---|---|
| HEX | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| HEXA | ✔ | ✔ | ✔ | ✖ | ✔ | ✖ |
| RGB | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| RGBA | ✔ | ✔ | ✔ | ✖ | ✔ | ✔ |
| HSL | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ |
| HSLA | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ |
How to Control Transparency in HTML Emails Beyond Alpha Channels
Transparency can be controlled using the opacity CSS property, with values ranging from 0 (fully transparent) to 1 (fully opaque). It is supported by more than 70% of popular email clients. Exceptions include Outlook for Windows and some versions of Yahoo Mail and Mail.ru.
But how does opacity differ from alpha channels?
Alpha channels define the transparency of an individual color. For example, in the following case, only the blue background will be semi-transparent:
1 2 3 4 5 6<td style=" background-color: rgba(40, 58, 249, 0.5); color: #000000; "> Text on a semi-transparent background </td>
In contrast, opacity affects the entire element, including its background, text, borders, and so on. This means that with opacity: 0.5, the entire block becomes semi-transparent, which may reduce text contrast:
1 2 3 4 5 6 7<td style=" background-color: #283AF9; color: #000000; opacity: 0.5; "> Text on a semi-transparent background </td>

If an email client does not support opacity, transparency will not be applied, but the element's other styles will be retained. For example, a blue background defined as background-color: #283AF9 will remain opaque.
| Mail.ru | Yandex Mail | Gmail | Outlook for Windows | Outlook (Web, Android, iOS) | Yahoo Mail | |
|---|---|---|---|---|---|---|
| opacity | ✔ | ✔ | ✔ | ✖ | ✔ | ✔ |
How to Use Gradients in Emails
Gradients create smooth transitions between two or more colors. In CSS, they are defined using background-image or the shorthand background property. A gradient defined using background-image is layered over the base background color (background-color), if one is specified.
Linear and radial gradients are among the gradient types used in email design. They differ in how one color transitions into another:

Support for linear and radial gradients varies across email clients. For example, they do not work in Yahoo Mail, require additional VML markup in Outlook for Windows, and may not be displayed in Gmail for Android if defined using background-image in the style attribute.
The background color beneath a gradient can serve as a fallback if the email client fails to display the gradient:
background-color: #283AF9;
background-image: linear-gradient(to right, #283AF9, #43E7FF);
In this case, if the gradient is not rendered, the block will be colored blue. In table-based email layouts, the bgcolor attribute should be used for additional compatibility.
An alternative to CSS gradients is to use pre-made images containing color transitions. However, email clients may block these images from loading, and displaying background images in Outlook may require additional VML markup. Therefore, when designing an email, it is worth considering how a block will look without its gradient to ensure that the absence of the color transition does not affect readability.
| Mail.ru | Yandex Mail | Gmail | Outlook for Windows | Outlook (Web, Android, iOS) | Yahoo Mail | |
|---|---|---|---|---|---|---|
| linear-gradient | ✔ | ✔ | ✔ | ✖ | ✖ | ✖ |
| radial-gradient | ✔ | ✖ | ✔ | ✖ | ✖ | ✖ |
How Colors Behave in Dark Mode
When dark mode is enabled, email clients may automatically change the colors of an HTML email. However, the result depends on which email client the message is opened in and how that client processes colors.
There are three main types of behavior:
- No automatic conversion. The email client's interface becomes darker, but the colors of the email itself remain unchanged.
- Partial inversion. Light backgrounds become dark, and dark text becomes light. Elements that were originally dark retain their colors.
- Full inversion. Both light and dark colors are transformed. For example, a dark block with light text may become a light block with dark text.

For some email clients, a separate dark mode design can be defined. For example, Apple Mail supports the @media (prefers-color-scheme: dark) media query, which can be used to specify custom styles for the dark mode version of an email:
1 2 3 4 5 6 7 8 9 10 11.email-content { background-color: #FFFFFF; color: #222222; } @media (prefers-color-scheme: dark) { .email-content { background-color: #191919 !important; color: #FFFFFF !important; } }
If necessary, you can also provide two versions of a logo: one for light mode and another for dark mode. To add both logos to an email, first include them in the code:
<img class="light-img" src="light_logo.png" alt="Light Logo">
<img class="dark-img" src="dark_logo.png" alt="Dark Logo" style="display: none;">
Then add the rules controlling their visibility to the media query:
@media (prefers-color-scheme: dark) {
.light-img { display: none !important; }
.dark-img { display: block !important; }
}
However, most email clients, including Gmail and Yandex Mail, do not support prefers-color-scheme. Therefore, it is important to check how an email looks in dark mode when its colors are automatically changed and its custom styles are ignored.
| Mail.ru | Yandex Mail | Gmail | Outlook for Windows | Outlook (Web, Android, iOS) | Yahoo Mail | |
|---|---|---|---|---|---|---|
| prefers-color-scheme support | Web interface only | ✖ | ✖ | ✖ | ✔* | ✖ |
* The Outlook web interface applies styles defined using prefers-color-scheme, but follows the browser's selected color scheme rather than the theme of the website's interface.
When it comes to CSS gradients, in some email clients, they retain their original colors in dark mode. If the color of the text placed over a gradient changes, the text may lose contrast. To avoid this, it is better to place important text on a solid-color background.
Working With Colors in AMP Emails
Defining colors in AMP emails is more straightforward than in regular HTML emails. AMP has an official list of supported CSS properties, including color, background-color, background-image, border-color, opacity, and others.
You can refer to this list when coding an email without having to come up with separate solutions for each email client.
As for how colors are displayed in dark mode, the result largely depends on the platform and email client. For example:
- In Gmail for Android, the colors of light AMP emails are automatically changed in dark mode, while emails that are originally dark retain their appearance.
- In Gmail for iOS, the colors of AMP emails are not automatically changed: the original design is preserved regardless of the selected theme.
- In Mail.ru, separate light and dark mode designs can be configured for AMP emails. To do this, add the following meta tag to the email's
<head>:<meta name="supported-color-schemes" content="light dark">. Then use the CSS selectors:root:not([data-ogsc])for light mode and:root[data-ogsc]for dark mode. These selectors are used to define the desired colors of backgrounds, text, and other elements.
Before sending an AMP email, always check how it is displayed across different email clients and themes, especially if its design includes colored backgrounds, transparency, or text placed over images.
Conclusion
Colors in HTML emails can be defined in various ways, with transparency and gradients, as well as separate designs for light and dark modes. The important thing is to consider the rendering behavior of different email clients and choose solutions with suitable compatibility.
And to add more interesting details to your email design, you could experiment with background images. You can learn more about them in this article, which is part of our series on the fundamentals of email coding.