package main import ( "bytes" "context" "fmt" "git.dev.alexdunmow.com/block/core/templates" ) // CoffeeEmailWrapper renders a single-column 560px cream-and-espresso wrapper // for transactional and newsletter emails. Table-only layout so it survives // Outlook; doodle divider rendered inline as SVG so it survives email // clients that strip styles. func CoffeeEmailWrapper(body string, emailCtx templates.EmailContext) string { var buf bytes.Buffer _ = coffeeEmailTemplate(emailCtx, body).Render(context.Background(), &buf) return buf.String() } templ coffeeEmailTemplate(emailCtx templates.EmailContext, body string) { { emailCtx.SiteSettings.SiteName } if emailCtx.PreviewText != "" {
{ emailCtx.PreviewText }
}
} // Coffee email color helpers — cream paper background, espresso ink, terracotta accent. // EmailColors carries the resolved theme palette; we use Primary for the // accent fallback because EmailColors has no dedicated Accent field. func coffeeBgColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.Background != "" { return emailCtx.Colors.Background } return "#f4ece1" } func coffeeCardColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.Card != "" { return emailCtx.Colors.Card } return "#ece1d0" } func coffeeFgColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.Foreground != "" { return emailCtx.Colors.Foreground } return "#3d2a1a" } func coffeePrimaryColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.Primary != "" { return emailCtx.Colors.Primary } return "#8a4a23" } // coffeeAccentColor reuses Primary when no dedicated accent is in scope — // EmailColors does not expose Accent; the resolved palette still applies via // Primary which the CMS sets per-email. func coffeeAccentColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.Primary != "" { return emailCtx.Colors.Primary } return "#c95b2f" } func coffeeMutedFgColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.MutedForeground != "" { return emailCtx.Colors.MutedForeground } return "#6b5440" } func coffeeBorderColor(emailCtx templates.EmailContext) string { if emailCtx.Colors.Border != "" { return emailCtx.Colors.Border } return "#c9b69e" }