Skip to content

Instantly share code, notes, and snippets.

@boredzo
Last active April 9, 2022 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boredzo/ff378572279b8aee12f3d547401d8d3f to your computer and use it in GitHub Desktop.
Save boredzo/ff378572279b8aee12f3d547401d8d3f to your computer and use it in GitHub Desktop.
Gmail basic UI dark mode stylesheet
/*Gmail dark mode*/
@media(prefers-color-scheme: dark) {
/*
Ideally we could set the background-color of the body itself, but there's no way to refer to that element specifically enough to not also apply to many other sites. This is as close as we can get and it's still fairly generic (though maybe bgcolor= is rare enough these days that it could work).
Next best thing is to set the background-color of every sibling of Gmail's canonical link, which works except for thin strips on the left and right. Oh well.
html[lang="en"] body[bgcolor="#ffffff"],
*/
link[href="https://mail.google.com/mail/"] ~ * {
background-color: #222 !important;
}
link[href="https://mail.google.com/mail/"] ~ * a:link,
link[href="https://mail.google.com/mail/"] ~ * a:active,
link[href="https://mail.google.com/mail/"] ~ * a:visited {
color: #2887F7 !important;
}
link[href="https://mail.google.com/mail/"] ~ * a.gb1,
link[href="https://mail.google.com/mail/"] ~ * a.gb4 {
color: #2887F7 !important;
}
link[href="https://mail.google.com/mail/"] ~ * font[color="#000000"],
link[href="https://mail.google.com/mail/"] ~ div#gbar,
link[href="https://mail.google.com/mail/"] ~ div#guser {
color: #eee !important;
}
link[href="https://mail.google.com/mail/"] ~ table {
color: #ddd !important;
}
link[href="https://mail.google.com/mail/"] ~ table table.th {
color: #ddd !important;
}
link[href="https://mail.google.com/mail/"] ~ table tr[bgcolor="#ffffff"] {
background-color: #222 !important;
color: #ddd !important;
}
link[href="https://mail.google.com/mail/"] ~ table tr[bgcolor="#E8EEF7"] {
background-color: #163565 !important;
color: #ddd !important;
}
link[href="https://mail.google.com/mail/"] ~ table *[bgcolor="#C3D9FF"] {
background-color: #1e3763 !important;
color: #ddd !important;
}
link[href="https://mail.google.com/mail/"] ~ table *[bgcolor="#CCCCCC"] {
background-color: #444 !important;
color: #ddd !important;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment