Skip to content

Commit e54b6ab

Browse files
committed
chore(emails): drop the wordmark generator script
The raster is committed at 4x, so the display box can be retuned without re-exporting it — the script only ever ran by hand, and the test pinning the asset to an exact multiple of the box would have forced a pointless regeneration on any size tweak. Keep the shared outlines the navbar and 8 other surfaces already render, record how the asset was produced on the size constant, and assert the property that actually matters: the asset out-resolves its display box.
1 parent 7e3ac86 commit e54b6ab

4 files changed

Lines changed: 21 additions & 79 deletions

File tree

apps/sim/lib/branding/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
export { defaultBrandConfig } from './defaults'
22
export type { BrandConfig, ThemeColors } from './types'
33
export { HEX_COLOR_REGEX } from './types'
4-
export {
5-
EMAIL_WORDMARK_SCALE,
6-
EMAIL_WORDMARK_SIZE,
7-
WORDMARK_PATHS,
8-
WORDMARK_VIEW_BOX,
9-
} from './wordmark'
4+
export { EMAIL_WORDMARK_SIZE, WORDMARK_PATHS, WORDMARK_VIEW_BOX } from './wordmark'

apps/sim/lib/branding/wordmark.test.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
import { readFileSync } from 'node:fs'
55
import path from 'node:path'
66
import { describe, expect, it } from 'vitest'
7-
import {
8-
EMAIL_WORDMARK_SCALE,
9-
EMAIL_WORDMARK_SIZE,
10-
WORDMARK_PATHS,
11-
WORDMARK_VIEW_BOX,
12-
} from '@/lib/branding/wordmark'
7+
import { EMAIL_WORDMARK_SIZE, WORDMARK_PATHS, WORDMARK_VIEW_BOX } from '@/lib/branding/wordmark'
8+
9+
/** Email clients do no responsive image selection, so the asset carries retina detail itself. */
10+
const MIN_RETINA_SCALE = 2
1311

1412
const WORDMARK_PNG = path.join(
1513
import.meta.dirname,
@@ -29,11 +27,17 @@ function readPngSize(file: string): { width: number; height: number } {
2927
}
3028

3129
describe('email wordmark asset', () => {
32-
it('is committed at the scale the email header renders it', () => {
33-
expect(readPngSize(WORDMARK_PNG)).toEqual({
34-
width: EMAIL_WORDMARK_SIZE.width * EMAIL_WORDMARK_SCALE,
35-
height: EMAIL_WORDMARK_SIZE.height * EMAIL_WORDMARK_SCALE,
36-
})
30+
it('out-resolves the box the email header renders it in', () => {
31+
const { width, height } = readPngSize(WORDMARK_PNG)
32+
expect(width).toBeGreaterThanOrEqual(EMAIL_WORDMARK_SIZE.width * MIN_RETINA_SCALE)
33+
expect(height).toBeGreaterThanOrEqual(EMAIL_WORDMARK_SIZE.height * MIN_RETINA_SCALE)
34+
})
35+
36+
it('is committed at the aspect ratio the header displays it at', () => {
37+
const { width, height } = readPngSize(WORDMARK_PNG)
38+
const assetAspect = width / height
39+
const boxAspect = EMAIL_WORDMARK_SIZE.width / EMAIL_WORDMARK_SIZE.height
40+
expect(Math.abs(assetAspect - boxAspect) / boxAspect).toBeLessThan(0.01)
3741
})
3842

3943
it('renders the mark at the brand outlines aspect ratio, within a rounding pixel', () => {

apps/sim/lib/branding/wordmark.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ export const WORDMARK_PATHS: readonly string[] = [
2323
* below (18px ink against 14px chip labels). Email body copy is 16px, so the
2424
* mark stands 20px tall; the width follows the view box. Both dimensions are
2525
* pinned because email clients do no responsive image selection.
26+
*
27+
* The header renders `public/brand/color/email/wordmark.png` rather than these
28+
* paths, because email clients strip inline SVG. That file is these outlines
29+
* filled with the email palette's `textBody`, rasterized at 4x so the mark
30+
* stays crisp on retina and this box can be retuned without re-exporting it.
2631
*/
2732
export const EMAIL_WORDMARK_SIZE = { width: 42, height: 20 } as const
28-
29-
/** Retina factor the email raster is generated at. */
30-
export const EMAIL_WORDMARK_SCALE = 4

apps/sim/scripts/generate-email-wordmark.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)