Fix email template dark mode rendering by forcing light theme#614
Fix email template dark mode rendering by forcing light theme#614aswinms926 wants to merge 2 commits intoopenwisp:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
🔇 Additional comments (4)
📝 WalkthroughWalkthroughThe email template was updated to force a light color scheme in email clients by adding a meta tag and a Sequence Diagram(s)Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@openwisp_utils/admin_theme/templates/openwisp_utils/email_template.html`:
- Around line 12-15: Remove the invalid CSS declaration
"supported-color-schemes: light only;" from the :root block in the email
template and keep only the valid "color-scheme: light only;" property so
browsers and email clients don't silently ignore the rule; update the :root rule
in openwisp_utils/admin_theme/templates/openwisp_utils/email_template.html (the
:root CSS block) accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a2fbe506-e86b-4303-9aea-a46ba457e5a9
📒 Files selected for processing (1)
openwisp_utils/admin_theme/templates/openwisp_utils/email_template.html
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Python==3.10 | django~=4.2.0
- GitHub Check: Python==3.12 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=4.2.0
- GitHub Check: Python==3.11 | django~=5.2.0
- GitHub Check: Python==3.10 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=5.0.0
- GitHub Check: Python==3.12 | django~=5.2.0
- GitHub Check: Python==3.13 | django~=5.1.0
🔇 Additional comments (3)
openwisp_utils/admin_theme/templates/openwisp_utils/email_template.html (3)
8-9: LGTM!The meta tags correctly declare light-only color scheme using both the standard
color-schemeand the Apple Mail-specificsupported-color-schemesfor maximum email client compatibility.
82-87: LGTM!Explicitly setting
background-color:#ffffff`` on the logo container ensures the logo remains visible when email clients apply dark mode transformations. The padding and border-radius are sensible visual improvements.
199-203: Good use of Outlook-specific dark mode selectors.The
[data-ogsc]and[data-ogsb]attribute selectors correctly target Outlook's dark mode states, and the!importantdeclaration is appropriate here to override Outlook's injected styles.Minor: Line 199 has trailing whitespace that could be cleaned up.
QA and Commit Message FailuresHello @aswinms926, There are two main issues identified in the CI logs:
Here's a breakdown of each failure and how to fix it: 1. Code Style/QA Failure: Missing Newline
2. Commit Message Failure
|
127e1c6 to
fef6913
Compare
Commit Message FailureHello @aswinms926, Your commit message is failing the CI checks because it does not adhere to the expected format. Specifically, the commit message is missing a reference to the issue number in the body, even though it's present in the title. Explanation: The OpenWISP project enforces a strict commit message convention to ensure clarity and traceability. The Remediation: Please update your commit message to include the issue reference in the body. Here's a template for the correct format: |
Some email clients automatically force dark mode on email content, making the logo invisible. Added color-scheme meta tag and CSS property to explicitly force a light color scheme. Removed the invalid supported-color-schemes meta tag and CSS property, keeping only the standard color-scheme. Fixes openwisp#490
fef6913 to
ff62765
Compare
Checklist
Reference to Existing Issue
Closes #490
Description of Changes
This change fixes the issue where some email clients automatically force dark mode
on email content, causing the logo to become nearly invisible.
The email template is updated to explicitly declare a light color scheme so that
email clients do not apply automatic dark mode transformations.
This ensures the email background remains white and the logo stays visible even
when the email client is set to dark mode.