themes-y2k/email_wrapper.go
Alex Dunmow 49f9c90589 initial: theme plugin y2k
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/y2k.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:46 +08:00

84 lines
2.1 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/templates"
)
// Y2KEmailWrapper wraps body content in a Y2K-branded email shell:
//
// - Centred 600px chrome-bordered card on a near-black background.
// - Magenta-to-teal gradient header bar.
// - Inter Tight body (with system fallback).
// - Plain marquee pill footer.
//
// All colours are sourced from emailCtx.Colors when present, falling back to
// HSL token-equivalent hex values that match the chrome-dream dark preset.
func Y2KEmailWrapper(body string, emailCtx templates.EmailContext) string {
var buf bytes.Buffer
_ = y2kEmailTemplate(emailCtx, body).Render(context.Background(), &buf)
return buf.String()
}
// Resolved palette per render — these helpers translate the preset HSL triples
// to email-safe hex via theme tokens, with fallbacks aligned to the
// chrome-dream dark preset.
func y2kEmailBg(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Background != "" {
return emailCtx.Colors.Background
}
return "#0c0820" // chrome-dream dark background equivalent
}
func y2kEmailCard(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Card != "" {
return emailCtx.Colors.Card
}
return "#150f2a"
}
func y2kEmailFg(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Foreground != "" {
return emailCtx.Colors.Foreground
}
return "#f4e8fa"
}
func y2kEmailMuted(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Muted != "" {
return emailCtx.Colors.Muted
}
return "#1f1740"
}
func y2kEmailMutedFg(emailCtx templates.EmailContext) string {
if emailCtx.Colors.MutedForeground != "" {
return emailCtx.Colors.MutedForeground
}
return "#b9a8d3"
}
func y2kEmailBorder(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Border != "" {
return emailCtx.Colors.Border
}
return "#4d2b6f"
}
func y2kEmailPrimary(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Primary != "" {
return emailCtx.Colors.Primary
}
return "#ff4dd2"
}
func y2kEmailSecondary(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Secondary != "" {
return emailCtx.Colors.Secondary
}
return "#4ddff0"
}