Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@kentcdodds/package-app-kit

Design tokens, PWA install/update, About/version, cache helpers, and optional realtime notes sync for Kody package apps.

src/brand.ts

33 lines · 971 B · TypeScript
/**
 * Brand logo helpers for the kit demo. PNG bytes live in `./brand-png-bytes.ts`
 * (mirrors `public/brand/logo-bust.png` + `logo-full.png`).
 *
 * Serve via app routes (same as `iconPngResponse`) so `<img>` tags do not depend
 * on `_assets/brand/*` static asset fetches.
 */
import { LOGO_BUST_BYTES, LOGO_FULL_BYTES } from './brand-png-bytes.ts'

export type BrandLogoKind = 'bust' | 'full'

const LOGO_BYTES: Record<BrandLogoKind, Uint8Array> = {
	bust: LOGO_BUST_BYTES,
	full: LOGO_FULL_BYTES,
}

/** Bump when brand PNGs change so clients refresh. */
export const BRAND_ASSET_REVISION = '8'

export function brandPngBytes(kind: BrandLogoKind): Uint8Array {
	return LOGO_BYTES[kind]
}

export function brandPngResponse(kind: BrandLogoKind): Response {
	const body = brandPngBytes(kind)
	return new Response(body, {
		headers: {
			'content-type': 'image/png',
			'cache-control': 'public, max-age=86400',
			'content-length': String(body.byteLength),
		},
	})
}