Newsletter: title color, and color pickers instead of palette dropdowns

Every part color (band, underline, card bar, line, divider, and now the title) is any hex color from a picker; blank is the default, typing none still means no color. Saved drafts keep their colors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-04 23:28:52 -05:00
parent 24450fba6c
commit f52a74a383
2 changed files with 18 additions and 20 deletions

View file

@ -26,8 +26,8 @@
cards and dividers (with their color, thickness and
spacing); a video is its still linked to the video
Colors are the site's palette (STORED_PALETTE) or "none"; blank is the
default. No unsubscribe link: Mailchimp adds its own to every send.
Colors are any hex color, picked in the builder, or "none"; blank
is the default (EMAIL_COLOR). No unsubscribe link: Mailchimp adds its own to every send.
Email clients ignore stylesheets, CSS variables and most layout,
so the HTML is tables with inline styles at 600px, images with
@ -104,7 +104,7 @@ export type Newsletter = {
}
/* The palette as an inbox needs it. */
const COLOR = {
export const EMAIL_COLOR = {
ink: '#001011',
body: '#003a45',
muted: '#3b5456',
@ -113,6 +113,7 @@ const COLOR = {
card: '#ffffff',
rule: '#d6f5fa',
}
const COLOR = EMAIL_COLOR
/* What each picks section is called and says on its buttons, unless
the part says otherwise. */
@ -368,7 +369,7 @@ function partHtml(part: NewsletterPart, n: Newsletter): string {
case 'header':
return headerHtml(part, n)
case 'title':
return `<tr><td style="padding:28px 24px 0;text-align:${alignOf(part)};"><h1 style="margin:0;font-family:${FONT};font-size:28px;line-height:34px;font-weight:700;color:${COLOR.ink};">${escape(part.text?.trim() || DEFAULT_TITLE(n.siteName))}</h1></td></tr>`
return `<tr><td style="padding:28px 24px 0;text-align:${alignOf(part)};"><h1 style="margin:0;font-family:${FONT};font-size:28px;line-height:34px;font-weight:700;color:${colorOf(part.color, COLOR.ink) ?? COLOR.ink};">${escape(part.text?.trim() || DEFAULT_TITLE(n.siteName))}</h1></td></tr>`
case 'picks':
return picksHtml(part, n)
case 'footer':