Skip to content

Commit 36a1edf

Browse files
committed
Implement dark mode styles for email layout and templates
1 parent 53fd5da commit 36a1edf

File tree

2 files changed

+26
-87
lines changed

2 files changed

+26
-87
lines changed

src/Illuminate/Mail/resources/views/html/layout.blade.php

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,77 +8,9 @@
88
<meta name="supported-color-schemes" content="light dark">
99
<style>
1010
@media (prefers-color-scheme: dark) {
11-
body,
12-
.wrapper,
13-
.body {
14-
background-color: #18181b !important;
15-
}
16-
17-
.inner-body {
18-
background-color: #27272a !important;
19-
border-color: #3f3f46 !important;
20-
}
21-
22-
p,
23-
ul,
24-
ol,
25-
blockquote,
26-
span,
27-
td {
28-
color: #e4e4e7 !important;
29-
}
30-
31-
a {
32-
color: #a5b4fc !important;
33-
}
34-
35-
h1,
36-
h2,
37-
h3,
38-
.header a {
39-
color: #fafafa !important;
40-
}
41-
4211
.logo {
4312
filter: invert(23%) sepia(5%) saturate(531%) hue-rotate(202deg) brightness(96%) contrast(91%) !important;
4413
}
45-
46-
.footer p,
47-
.footer a {
48-
color: #71717a !important;
49-
}
50-
51-
.panel-content {
52-
background-color: #3f3f46 !important;
53-
}
54-
55-
.panel-content p {
56-
color: #e4e4e7 !important;
57-
}
58-
59-
.subcopy {
60-
border-top-color: #3f3f46 !important;
61-
}
62-
63-
.table th {
64-
border-bottom-color: #3f3f46 !important;
65-
}
66-
}
67-
68-
@media only screen and (max-width: 600px) {
69-
.inner-body {
70-
width: 100% !important;
71-
}
72-
73-
.footer {
74-
width: 100% !important;
75-
}
76-
}
77-
78-
@media only screen and (max-width: 500px) {
79-
.button {
80-
width: 100% !important;
81-
}
8214
}
8315
</style>
8416
{!! $head ?? '' !!}

src/Illuminate/Mail/resources/views/html/themes/default.css

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* Base */
22

3+
:root {
4+
color-scheme: light dark;
5+
}
6+
37
body,
48
body *:not(html):not(style):not(br):not(tr):not(code) {
59
box-sizing: border-box;
@@ -10,8 +14,8 @@ body *:not(html):not(style):not(br):not(tr):not(code) {
1014

1115
body {
1216
-webkit-text-size-adjust: none;
13-
background-color: #ffffff;
14-
color: #52525b;
17+
background-color: light-dark(#ffffff, #18181b);
18+
color: light-dark(#52525b, #e4e4e7);
1519
height: 100%;
1620
line-height: 1.4;
1721
margin: 0;
@@ -23,12 +27,13 @@ p,
2327
ul,
2428
ol,
2529
blockquote {
30+
color: light-dark(#52525b, #e4e4e7);
2631
line-height: 1.4;
2732
text-align: left;
2833
}
2934

3035
a {
31-
color: #18181b;
36+
color: light-dark(#18181b, #a5b4fc);
3237
}
3338

3439
a img {
@@ -38,21 +43,23 @@ a img {
3843
/* Typography */
3944

4045
h1 {
41-
color: #18181b;
46+
color: light-dark(#18181b, #fafafa);
4247
font-size: 18px;
4348
font-weight: bold;
4449
margin-top: 0;
4550
text-align: left;
4651
}
4752

4853
h2 {
54+
color: light-dark(#18181b, #fafafa);
4955
font-size: 16px;
5056
font-weight: bold;
5157
margin-top: 0;
5258
text-align: left;
5359
}
5460

5561
h3 {
62+
color: light-dark(#18181b, #fafafa);
5663
font-size: 14px;
5764
font-weight: bold;
5865
margin-top: 0;
@@ -80,7 +87,7 @@ img {
8087
-premailer-cellpadding: 0;
8188
-premailer-cellspacing: 0;
8289
-premailer-width: 100%;
83-
background-color: #fafafa;
90+
background-color: light-dark(#fafafa, #18181b);
8491
margin: 0;
8592
padding: 0;
8693
width: 100%;
@@ -103,7 +110,7 @@ img {
103110
}
104111

105112
.header a {
106-
color: #18181b;
113+
color: light-dark(#18181b, #fafafa);
107114
font-size: 19px;
108115
font-weight: bold;
109116
text-decoration: none;
@@ -125,9 +132,9 @@ img {
125132
-premailer-cellpadding: 0;
126133
-premailer-cellspacing: 0;
127134
-premailer-width: 100%;
128-
background-color: #fafafa;
129-
border-bottom: 1px solid #fafafa;
130-
border-top: 1px solid #fafafa;
135+
background-color: light-dark(#fafafa, #18181b);
136+
border-bottom: 1px solid light-dark(#fafafa, #18181b);
137+
border-top: 1px solid light-dark(#fafafa, #18181b);
131138
margin: 0;
132139
padding: 0;
133140
width: 100%;
@@ -137,8 +144,8 @@ img {
137144
-premailer-cellpadding: 0;
138145
-premailer-cellspacing: 0;
139146
-premailer-width: 570px;
140-
background-color: #ffffff;
141-
border-color: #e4e4e7;
147+
background-color: light-dark(#ffffff, #27272a);
148+
border-color: light-dark(#e4e4e7, #3f3f46);
142149
border-radius: 4px;
143150
border-width: 1px;
144151
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
@@ -154,7 +161,7 @@ img {
154161
/* Subcopy */
155162

156163
.subcopy {
157-
border-top: 1px solid #e4e4e7;
164+
border-top: 1px solid light-dark(#e4e4e7, #3f3f46);
158165
margin-top: 25px;
159166
padding-top: 25px;
160167
}
@@ -176,13 +183,13 @@ img {
176183
}
177184

178185
.footer p {
179-
color: #a1a1aa;
186+
color: light-dark(#a1a1aa, #71717a);
180187
font-size: 12px;
181188
text-align: center;
182189
}
183190

184191
.footer a {
185-
color: #a1a1aa;
192+
color: light-dark(#a1a1aa, #71717a);
186193
text-decoration: underline;
187194
}
188195

@@ -197,13 +204,13 @@ img {
197204
}
198205

199206
.table th {
200-
border-bottom: 1px solid #e4e4e7;
207+
border-bottom: 1px solid light-dark(#e4e4e7, #3f3f46);
201208
margin: 0;
202209
padding-bottom: 8px;
203210
}
204211

205212
.table td {
206-
color: #52525b;
213+
color: light-dark(#52525b, #e4e4e7);
207214
font-size: 15px;
208215
line-height: 18px;
209216
margin: 0;
@@ -272,13 +279,13 @@ img {
272279
}
273280

274281
.panel-content {
275-
background-color: #fafafa;
276-
color: #52525b;
282+
background-color: light-dark(#fafafa, #3f3f46);
283+
color: light-dark(#52525b, #e4e4e7);
277284
padding: 16px;
278285
}
279286

280287
.panel-content p {
281-
color: #52525b;
288+
color: light-dark(#52525b, #e4e4e7);
282289
}
283290

284291
.panel-item {

0 commit comments

Comments
 (0)