export const EMAIL_COLORS = {
bg: '#171717',
card: '#252525',
cardInner: '#2f2f2f',
border: '#3a3a3a',
accent: '#7aa7ff',
accentDark: '#243656',
text: '#f5f5f5',
textSecondary: '#c6c6cc',
textDim: '#8d8d95',
} as const;
function brandLogoSvg(): string {
return ``;
}
export function escapeHtml(str: string): string {
return str
.replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"');
}
export function escapeAttr(str: string): string {
return str
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(//g, '>');
}
export function brandedEmailTemplate(
body: string,
options?: {
footerText?: string;
footerLinkText?: string;
footerLinkUrl?: string;
}
): string {
const footerText = options?.footerText || '';
const footerLinkText = options?.footerLinkText || '';
const footerLinkUrl = options?.footerLinkUrl || '';
return `
| ${brandLogoSvg()} |
OpenFrame |
|
|
${body}
|
${
footerText || (footerLinkText && footerLinkUrl)
? `
|
${footerText ? ` ${footerText} ` : ''}
${footerLinkText && footerLinkUrl ? `${escapeHtml(footerLinkText)}` : ''}
| `
: ''
}
|
`;
}
export function emailHeading(icon: string, title: string): string {
return `
${icon} ${title}
| `;
}
export function emailRow(label: string, value: string, isHighlight = false): string {
const valStyle = isHighlight
? `color:${EMAIL_COLORS.text};font-weight:600;`
: `color:${EMAIL_COLORS.textSecondary};`;
return `
| ${label} |
${value} |
`;
}
export function emailButton(text: string, url: string): string {
return `${text}`;
}
export function emailHighlight(text: string): string {
return `${text}
`;
}