English 中文(简体)
如何在 gmail 中强制显示暗色模式的背景颜色?
原标题:How to force background color in gmail for Dark Mode?
I am working on HTML email templates.I am stuck with forcing background color and text color attributes for Dark mode.My normal inline css is background-color:#f2f2f2 and color:#191919.But in dark mode I want background-color:#ff5f00 and color:#ffffff. I am able to achieve the same in outlook using @media but as said in various blogs to use blend modes for gmail,I am not able to achieve the same.Can anyone help with a HTML template or HTML code? CODE:
Dark mode - System (User Agent Styles)
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Libero, facilis assumenda soluta id ut labore ipsa aliquam reprehenderit
Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Lorem ipsum dolor
问题回答
I would suggest using the @media (prefers-color-scheme: dark) media query and creating a couple classes. Then apply those classes to the elements that should have the darkmode style applied. Example: @media (prefers-color-scheme: dark) { .darkmode-bg { background-color: #ff5f00 !important; } .darkmode-color { color: #ffffff !important; } } It s hard to answer this without code to test, but that would be what I d suggest. Source. It s also recommended to add these meta tags in your tag to ensure that Dark Mode is enabled in your email for users that have Dark Mode turned on. I hope this helps!




相关问题
how does gmail detect mouse movement?

if you are inactive on gmail, by not moving your mouse for a while, it changes your chat status to orange which means idle. but when you start moving the mouse again it turns it back to green meaning ...

reading mails using python

how do i read mails from my mail box using python?? import getpass, imaplib M = imaplib.IMAP4( IMAP4.gmail.com:993 ) M.login(getpass.getuser(), getpass.getpass()) M.select() typ, data = M.search(None,...

SMTP Service not available

I am trying to create a web application which upon entering your email address and message , sends an email with this information from the email address. I used this: try { ...

How to auto log into gmail atom feed with Python?

Gmail has this sweet thing going on to get an atom feed: def gmail_url(user, pwd): return "https://"+str(user)+":"+str(pwd)+"@gmail.google.com/gmail/feed/atom" Now when you do this in a browser, ...

Can I build an addin for Gmail?

Is there a way I can create an addin for my Gmail account? Is GreaseMonkey the only real way? I use Gmail for customer service, and I d like to create a tool that looks up the customer and preps a ...

Web Link in a mail is not rendering as link in yahoo

string from = "abc@gmail.com"; string to = "xyz@gmail.com,xyz@yahoo.co.in"; string password="abcxyz"; MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(to); mail.From = new ...

热门标签