Email Theming
Theme Modes
email.WithThemeMode(EmailThemeMode.Light); // Always light
email.WithThemeMode(EmailThemeMode.Dark); // Always dark
email.WithThemeMode(EmailThemeMode.Auto); // Follow OS preference
Custom Colors
email.WithAccentColor("#4f46e5", "#a5b4fc"); // Light, Dark
email.WithSurfaceColor("#ffffff", "#0f172a");
email.WithTextColor("#0b1220", "#f8fafc");
Semantic Color Tokens
| Token | Purpose |
|---|---|
BodyBackground | Background behind main container |
Surface | Card/container background |
SubtleSurface | Subtle backgrounds (stripes, chips) |
Border | Borders and dividers |
Text | Primary text (headings) |
BodyText | Paragraph text |
MutedText | Secondary text |
Accent | Brand accent (buttons, links) |
Dark Mode Implementation
HtmlForgeX.Email uses:
@media (prefers-color-scheme: dark)for automatic switching- Stable
hfx-*CSS class hooks for safe overrides - Outlook.com-specific selectors
- Image dark-mode swapping via
WithDarkModeSource()