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

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

50 lines
1.6 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/templates"
)
// KindergartenEmailWrapper wraps email body content in a Kindergarten-branded
// rounded card. Uses a centered 600px table with a 32px border-radius card for
// clients that support it; Outlook degrades gracefully to a square card.
func KindergartenEmailWrapper(body string, emailCtx templates.EmailContext) string {
var buf bytes.Buffer
_ = kindergartenEmailTemplate(emailCtx, body).Render(context.Background(), &buf)
return buf.String()
}
// kgEmailColor returns the supplied hex color or the cream/foreground/etc.
// fallback when the engine has not resolved a value for the token.
func kgEmailColor(value, fallback string) string {
if value != "" {
return value
}
return fallback
}
// kgEmailBg / etc. group fallbacks for the cream/navy palette per spec §10.
func kgEmailBg(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.Background, "#fdf9ed")
}
func kgEmailCard(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.Card, "#ffffff")
}
func kgEmailFg(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.Foreground, "#1a253b")
}
func kgEmailMuted(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.MutedForeground, "#5a6480")
}
func kgEmailAccent(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.Primary, "#fbcd1f")
}
func kgEmailAccentFg(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.PrimaryForeground, "#1a253b")
}
func kgEmailBorder(ctx templates.EmailContext) string {
return kgEmailColor(ctx.Colors.Border, "#e6d9b3")
}