diff --git a/README.md b/README.md
index b103dab97..cc952391e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
-
+
+
+
+
> Create elegant code screenshots of your source code.
diff --git a/apps/codeimage/index.html b/apps/codeimage/index.html
index 34917f9c7..3ad370f02 100644
--- a/apps/codeimage/index.html
+++ b/apps/codeimage/index.html
@@ -4,7 +4,8 @@
-
+
+
-
+
+
-
diff --git a/apps/codeimage/public/assets/favicon.ico b/apps/codeimage/public/assets/favicon.ico
index 5edef4b93..b707ac73f 100644
Binary files a/apps/codeimage/public/assets/favicon.ico and b/apps/codeimage/public/assets/favicon.ico differ
diff --git a/apps/codeimage/public/assets/favicon.svg b/apps/codeimage/public/assets/favicon.svg
index a7a7a79bd..d32707a4f 100644
--- a/apps/codeimage/public/assets/favicon.svg
+++ b/apps/codeimage/public/assets/favicon.svg
@@ -1,18 +1,16 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/codeimage/public/pwa/apple-icon-180.png b/apps/codeimage/public/pwa/apple-icon-180.png
index bc888f059..a799a75fb 100644
Binary files a/apps/codeimage/public/pwa/apple-icon-180.png and b/apps/codeimage/public/pwa/apple-icon-180.png differ
diff --git a/apps/codeimage/public/pwa/manifest-icon-192.maskable.png b/apps/codeimage/public/pwa/manifest-icon-192.maskable.png
index 754de81eb..e4546a681 100644
Binary files a/apps/codeimage/public/pwa/manifest-icon-192.maskable.png and b/apps/codeimage/public/pwa/manifest-icon-192.maskable.png differ
diff --git a/apps/codeimage/public/pwa/manifest-icon-512.maskable.png b/apps/codeimage/public/pwa/manifest-icon-512.maskable.png
index 29287f577..ac8657e79 100644
Binary files a/apps/codeimage/public/pwa/manifest-icon-512.maskable.png and b/apps/codeimage/public/pwa/manifest-icon-512.maskable.png differ
diff --git a/assets/brand/README.md b/assets/brand/README.md
new file mode 100644
index 000000000..f6a6697a2
--- /dev/null
+++ b/assets/brand/README.md
@@ -0,0 +1,18 @@
+# CodeImage brand assets
+
+`logos/*.svg` and `source/` are the sources. Everything else is generated:
+
+```sh
+pnpm brand:build
+```
+
+The script renders with Playwright's Chromium and also copies the favicon, PWA icons and splash logo into `apps/codeimage/public`.
+
+| Folder | Contents |
+| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `logos/` | Mark, wordmark, and logo (mark with wordmark): full colour for dark and light backgrounds, one-colour black and white. SVG sources and PNG renders. |
+| `icons/` | `favicon.ico` (16, 32, 48), `favicon.svg`, PNG icons from 16 to 1024 px, `apple-touch-icon.png`, maskable 192 and 512 px. |
+| `social/` | Open Graph cards (dark, light), GitHub social preview, README banners and CLI banners, at 2x. |
+| `source/` | Full-bleed and maskable variants of the mark, and the code window from the website hero used by the cards. |
+
+Colours: blue `#0077ff` to `#0066cc`. The cards use Mona Sans from `apps/website/public/fonts`.
diff --git a/assets/brand/icons/apple-touch-icon.png b/assets/brand/icons/apple-touch-icon.png
new file mode 100644
index 000000000..a799a75fb
Binary files /dev/null and b/assets/brand/icons/apple-touch-icon.png differ
diff --git a/assets/brand/icons/favicon.ico b/assets/brand/icons/favicon.ico
new file mode 100644
index 000000000..b707ac73f
Binary files /dev/null and b/assets/brand/icons/favicon.ico differ
diff --git a/assets/brand/icons/favicon.svg b/assets/brand/icons/favicon.svg
new file mode 100644
index 000000000..d32707a4f
--- /dev/null
+++ b/assets/brand/icons/favicon.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/icons/icon-1024.png b/assets/brand/icons/icon-1024.png
new file mode 100644
index 000000000..6f62eef43
Binary files /dev/null and b/assets/brand/icons/icon-1024.png differ
diff --git a/assets/brand/icons/icon-128.png b/assets/brand/icons/icon-128.png
new file mode 100644
index 000000000..d4187dd69
Binary files /dev/null and b/assets/brand/icons/icon-128.png differ
diff --git a/assets/brand/icons/icon-16.png b/assets/brand/icons/icon-16.png
new file mode 100644
index 000000000..f985098d5
Binary files /dev/null and b/assets/brand/icons/icon-16.png differ
diff --git a/assets/brand/icons/icon-192-maskable.png b/assets/brand/icons/icon-192-maskable.png
new file mode 100644
index 000000000..e4546a681
Binary files /dev/null and b/assets/brand/icons/icon-192-maskable.png differ
diff --git a/assets/brand/icons/icon-192.png b/assets/brand/icons/icon-192.png
new file mode 100644
index 000000000..66bae4d42
Binary files /dev/null and b/assets/brand/icons/icon-192.png differ
diff --git a/assets/brand/icons/icon-256.png b/assets/brand/icons/icon-256.png
new file mode 100644
index 000000000..46881d2e5
Binary files /dev/null and b/assets/brand/icons/icon-256.png differ
diff --git a/assets/brand/icons/icon-32.png b/assets/brand/icons/icon-32.png
new file mode 100644
index 000000000..8cc33d28d
Binary files /dev/null and b/assets/brand/icons/icon-32.png differ
diff --git a/assets/brand/icons/icon-48.png b/assets/brand/icons/icon-48.png
new file mode 100644
index 000000000..a561ba691
Binary files /dev/null and b/assets/brand/icons/icon-48.png differ
diff --git a/assets/brand/icons/icon-512-maskable.png b/assets/brand/icons/icon-512-maskable.png
new file mode 100644
index 000000000..ac8657e79
Binary files /dev/null and b/assets/brand/icons/icon-512-maskable.png differ
diff --git a/assets/brand/icons/icon-512.png b/assets/brand/icons/icon-512.png
new file mode 100644
index 000000000..1bb0e9122
Binary files /dev/null and b/assets/brand/icons/icon-512.png differ
diff --git a/assets/brand/icons/icon-64.png b/assets/brand/icons/icon-64.png
new file mode 100644
index 000000000..138cb4722
Binary files /dev/null and b/assets/brand/icons/icon-64.png differ
diff --git a/assets/brand/logos/logo-black.png b/assets/brand/logos/logo-black.png
new file mode 100644
index 000000000..e82f03baa
Binary files /dev/null and b/assets/brand/logos/logo-black.png differ
diff --git a/assets/brand/logos/logo-black.svg b/assets/brand/logos/logo-black.svg
new file mode 100644
index 000000000..0d8963057
--- /dev/null
+++ b/assets/brand/logos/logo-black.svg
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/logo-on-dark.png b/assets/brand/logos/logo-on-dark.png
new file mode 100644
index 000000000..0aaf386ac
Binary files /dev/null and b/assets/brand/logos/logo-on-dark.png differ
diff --git a/assets/brand/logos/logo-on-dark.svg b/assets/brand/logos/logo-on-dark.svg
new file mode 100644
index 000000000..0ca6a7616
--- /dev/null
+++ b/assets/brand/logos/logo-on-dark.svg
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/logo-on-light.png b/assets/brand/logos/logo-on-light.png
new file mode 100644
index 000000000..da807f8f3
Binary files /dev/null and b/assets/brand/logos/logo-on-light.png differ
diff --git a/assets/brand/logos/logo-on-light.svg b/assets/brand/logos/logo-on-light.svg
new file mode 100644
index 000000000..f22342a66
--- /dev/null
+++ b/assets/brand/logos/logo-on-light.svg
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/logo-white.png b/assets/brand/logos/logo-white.png
new file mode 100644
index 000000000..8911fbca4
Binary files /dev/null and b/assets/brand/logos/logo-white.png differ
diff --git a/assets/brand/logos/logo-white.svg b/assets/brand/logos/logo-white.svg
new file mode 100644
index 000000000..29fd5c009
--- /dev/null
+++ b/assets/brand/logos/logo-white.svg
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/mark-black.png b/assets/brand/logos/mark-black.png
new file mode 100644
index 000000000..1a33d3803
Binary files /dev/null and b/assets/brand/logos/mark-black.png differ
diff --git a/assets/brand/logos/mark-black.svg b/assets/brand/logos/mark-black.svg
new file mode 100644
index 000000000..85be09192
--- /dev/null
+++ b/assets/brand/logos/mark-black.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/mark-white.png b/assets/brand/logos/mark-white.png
new file mode 100644
index 000000000..2d892429a
Binary files /dev/null and b/assets/brand/logos/mark-white.png differ
diff --git a/assets/brand/logos/mark-white.svg b/assets/brand/logos/mark-white.svg
new file mode 100644
index 000000000..170d3ad11
--- /dev/null
+++ b/assets/brand/logos/mark-white.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/mark.png b/assets/brand/logos/mark.png
new file mode 100644
index 000000000..6f62eef43
Binary files /dev/null and b/assets/brand/logos/mark.png differ
diff --git a/assets/brand/logos/mark.svg b/assets/brand/logos/mark.svg
new file mode 100644
index 000000000..d32707a4f
--- /dev/null
+++ b/assets/brand/logos/mark.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/wordmark-black.png b/assets/brand/logos/wordmark-black.png
new file mode 100644
index 000000000..424f932ca
Binary files /dev/null and b/assets/brand/logos/wordmark-black.png differ
diff --git a/assets/brand/logos/wordmark-black.svg b/assets/brand/logos/wordmark-black.svg
new file mode 100644
index 000000000..07f6c22ea
--- /dev/null
+++ b/assets/brand/logos/wordmark-black.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/wordmark-on-dark.png b/assets/brand/logos/wordmark-on-dark.png
new file mode 100644
index 000000000..cf0f3c501
Binary files /dev/null and b/assets/brand/logos/wordmark-on-dark.png differ
diff --git a/assets/brand/logos/wordmark-on-dark.svg b/assets/brand/logos/wordmark-on-dark.svg
new file mode 100644
index 000000000..cd5105fdf
--- /dev/null
+++ b/assets/brand/logos/wordmark-on-dark.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/wordmark-on-light.png b/assets/brand/logos/wordmark-on-light.png
new file mode 100644
index 000000000..15a94dfb4
Binary files /dev/null and b/assets/brand/logos/wordmark-on-light.png differ
diff --git a/assets/brand/logos/wordmark-on-light.svg b/assets/brand/logos/wordmark-on-light.svg
new file mode 100644
index 000000000..cd73344b3
--- /dev/null
+++ b/assets/brand/logos/wordmark-on-light.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/logos/wordmark-white.png b/assets/brand/logos/wordmark-white.png
new file mode 100644
index 000000000..cf0f3c501
Binary files /dev/null and b/assets/brand/logos/wordmark-white.png differ
diff --git a/assets/brand/logos/wordmark-white.svg b/assets/brand/logos/wordmark-white.svg
new file mode 100644
index 000000000..cd5105fdf
--- /dev/null
+++ b/assets/brand/logos/wordmark-white.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/social/cli-banner-dark.png b/assets/brand/social/cli-banner-dark.png
new file mode 100644
index 000000000..07ccc3199
Binary files /dev/null and b/assets/brand/social/cli-banner-dark.png differ
diff --git a/assets/brand/social/cli-banner-light.png b/assets/brand/social/cli-banner-light.png
new file mode 100644
index 000000000..ad6312999
Binary files /dev/null and b/assets/brand/social/cli-banner-light.png differ
diff --git a/assets/brand/social/github-social-preview.png b/assets/brand/social/github-social-preview.png
new file mode 100644
index 000000000..b68fa121a
Binary files /dev/null and b/assets/brand/social/github-social-preview.png differ
diff --git a/assets/brand/social/og-dark.png b/assets/brand/social/og-dark.png
new file mode 100644
index 000000000..0f75546d3
Binary files /dev/null and b/assets/brand/social/og-dark.png differ
diff --git a/assets/brand/social/og-light.png b/assets/brand/social/og-light.png
new file mode 100644
index 000000000..6b822ec5c
Binary files /dev/null and b/assets/brand/social/og-light.png differ
diff --git a/assets/brand/social/readme-banner-dark.png b/assets/brand/social/readme-banner-dark.png
new file mode 100644
index 000000000..d49714bf0
Binary files /dev/null and b/assets/brand/social/readme-banner-dark.png differ
diff --git a/assets/brand/social/readme-banner-light.png b/assets/brand/social/readme-banner-light.png
new file mode 100644
index 000000000..361ff9390
Binary files /dev/null and b/assets/brand/social/readme-banner-light.png differ
diff --git a/assets/brand/source/code-window.png b/assets/brand/source/code-window.png
new file mode 100644
index 000000000..5440d03fe
Binary files /dev/null and b/assets/brand/source/code-window.png differ
diff --git a/assets/brand/source/mark-maskable.svg b/assets/brand/source/mark-maskable.svg
new file mode 100644
index 000000000..90c0dda31
--- /dev/null
+++ b/assets/brand/source/mark-maskable.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/brand/source/mark-square.svg b/assets/brand/source/mark-square.svg
new file mode 100644
index 000000000..29148bfad
--- /dev/null
+++ b/assets/brand/source/mark-square.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/package.json b/package.json
index a41415a1f..a46978595 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"libs:build:render": "pnpm --filter=@codeimage/render build",
"libs:build:watch": "pnpm --filter \"{packages/**}\" --filter='!@codeimage/config' --parallel --aggregate-output build:watch",
"kit:build": "pnpm --prefix=packages/kit build:kit",
+ "brand:build": "node scripts/brand/build.mjs",
"lint": "node scripts/check-structure.mjs && node scripts/lint.mjs",
"lint:tighten": "node scripts/lint.mjs --tighten",
"format": "oxfmt",
diff --git a/scripts/brand/build.mjs b/scripts/brand/build.mjs
new file mode 100644
index 000000000..dd6ba1b31
--- /dev/null
+++ b/scripts/brand/build.mjs
@@ -0,0 +1,215 @@
+import {mkdir, writeFile, copyFile} from 'node:fs/promises';
+import {dirname, join} from 'node:path';
+import {chromium} from 'playwright';
+import {
+ bannerLayout,
+ ogLayout,
+ social,
+ socialPreviewLayout,
+ terminal,
+} from './cards.mjs';
+import {brand, dataUri, logos, read, root} from './paths.mjs';
+
+const cliPackage = '@codeimage-app/cli';
+
+const out = async (path, data) => {
+ const target = join(brand, path);
+ await mkdir(dirname(target), {recursive: true});
+ await writeFile(target, data);
+ return target;
+};
+
+async function renderSvg(page, file, size) {
+ const svg = await dataUri(file, 'image/svg+xml');
+ await page.setViewportSize({width: size, height: size});
+ await page.setContent(
+ `
`,
+ );
+ await page.locator('img').evaluate(img => img.decode());
+ return page.screenshot({omitBackground: true});
+}
+
+async function renderLogo(page, file, width) {
+ const svg = await dataUri(file, 'image/svg+xml');
+ const [, , vbWidth, vbHeight] = (await read(file))
+ .toString()
+ .match(/viewBox="([^"]+)"/)[1]
+ .split(' ')
+ .map(Number);
+ const height = Math.round((width * vbHeight) / vbWidth);
+ await page.setViewportSize({width, height});
+ await page.setContent(
+ `
`,
+ );
+ await page.locator('img').evaluate(img => img.decode());
+ return page.screenshot({omitBackground: true});
+}
+
+function ico(images) {
+ const header = Buffer.alloc(6);
+ header.writeUInt16LE(0, 0);
+ header.writeUInt16LE(1, 2);
+ header.writeUInt16LE(images.length, 4);
+ let offset = 6 + images.length * 16;
+ const entries = images.map(({size, png}) => {
+ const entry = Buffer.alloc(16);
+ entry.writeUInt8(size >= 256 ? 0 : size, 0);
+ entry.writeUInt8(size >= 256 ? 0 : size, 1);
+ entry.writeUInt16LE(1, 4);
+ entry.writeUInt16LE(32, 6);
+ entry.writeUInt32LE(png.length, 8);
+ entry.writeUInt32LE(offset, 12);
+ offset += png.length;
+ return entry;
+ });
+ return Buffer.concat([header, ...entries, ...images.map(i => i.png)]);
+}
+
+async function main() {
+ const browser = await chromium.launch();
+ const page = await browser.newPage({deviceScaleFactor: 1});
+
+ const iconSizes = [16, 32, 48, 64, 128, 192, 256, 512, 1024];
+ const icons = {};
+ for (const size of iconSizes) {
+ icons[size] = await renderSvg(page, 'mark.svg', size);
+ await out(`icons/icon-${size}.png`, icons[size]);
+ }
+ await out(
+ 'icons/favicon.ico',
+ ico([16, 32, 48].map(size => ({size, png: icons[size]}))),
+ );
+ await out('icons/favicon.svg', await read('mark.svg'));
+ await out(
+ 'icons/apple-touch-icon.png',
+ await renderSvg(page, 'mark-square.svg', 180),
+ );
+ for (const size of [192, 512]) {
+ await out(
+ `icons/icon-${size}-maskable.png`,
+ await renderSvg(page, 'mark-maskable.svg', size),
+ );
+ }
+
+ for (const file of [
+ 'logo-on-dark',
+ 'logo-on-light',
+ 'logo-black',
+ 'logo-white',
+ 'wordmark-on-dark',
+ 'wordmark-on-light',
+ 'wordmark-black',
+ 'wordmark-white',
+ ]) {
+ await out(`logos/${file}.png`, await renderLogo(page, `${file}.svg`, 1888));
+ }
+ for (const file of ['mark', 'mark-black', 'mark-white']) {
+ await out(`logos/${file}.png`, await renderSvg(page, `${file}.svg`, 1024));
+ }
+
+ const codeWindow = `
`;
+ const cliArt = terminal([
+ ['comment', 'A file to an image.'],
+ ['command', `pnpm dlx ${cliPackage} src/example.ts -o example.png`],
+ ['comment', 'Your diff, marked.'],
+ ['command', `git diff | pnpm dlx ${cliPackage} --diff -o changes.png`],
+ ['comment', 'Two files, one animation.'],
+ [
+ 'command',
+ `pnpm dlx ${cliPackage} before.ts after.ts --animate -o change.gif`,
+ ],
+ ]);
+
+ const cards = [];
+ for (const theme of ['dark', 'light']) {
+ cards.push({
+ file: `social/og-${theme}.png`,
+ width: 1200,
+ height: 630,
+ theme,
+ layout: ogLayout,
+ title:
+ 'Beautify your code screenshots. And now,
animate them.',
+ url: 'codeimage.dev',
+ art: codeWindow,
+ });
+ cards.push({
+ file: `social/readme-banner-${theme}.png`,
+ width: 1280,
+ height: 420,
+ theme,
+ layout: bannerLayout,
+ title: 'Beautify your code screenshots. Then animate them.',
+ subtitle:
+ 'Free and open source. On the web, in your terminal and for agents.',
+ art: codeWindow,
+ });
+ cards.push({
+ file: `social/cli-banner-${theme}.png`,
+ width: 1280,
+ height: 420,
+ theme,
+ layout: {
+ ...bannerLayout,
+ title: 44,
+ textWidth: 580,
+ frameX: 628,
+ frameW: 700,
+ framePad: 34,
+ frameY: 70,
+ },
+ title: 'Code images and videos from your terminal.',
+ subtitle:
+ 'Renders in Node, with no browser. Secrets are redacted by default.',
+ art: cliArt,
+ });
+ }
+ cards.push({
+ file: 'social/github-social-preview.png',
+ width: 1280,
+ height: 640,
+ theme: 'dark',
+ layout: socialPreviewLayout,
+ title: 'Beautify your code screenshots. And now,
animate them.',
+ url: 'github.com/riccardoperra/codeimage',
+ art: codeWindow,
+ });
+
+ const cardPage = await browser.newPage({deviceScaleFactor: 2});
+ for (const card of cards) {
+ await cardPage.setViewportSize({width: card.width, height: card.height});
+ await cardPage.setContent(await social(card));
+ await cardPage.evaluate(() => document.fonts.ready);
+ await out(card.file, await cardPage.screenshot());
+ }
+
+ await browser.close();
+
+ const app = join(root, 'apps/codeimage/public');
+ await copyFile(
+ join(brand, 'icons/favicon.ico'),
+ join(app, 'assets/favicon.ico'),
+ );
+ await copyFile(
+ join(brand, 'icons/favicon.svg'),
+ join(app, 'assets/favicon.svg'),
+ );
+ await copyFile(
+ join(brand, 'icons/apple-touch-icon.png'),
+ join(app, 'pwa/apple-icon-180.png'),
+ );
+ await copyFile(
+ join(brand, 'icons/icon-192-maskable.png'),
+ join(app, 'pwa/manifest-icon-192.maskable.png'),
+ );
+ await copyFile(
+ join(brand, 'icons/icon-512-maskable.png'),
+ join(app, 'pwa/manifest-icon-512.maskable.png'),
+ );
+ await copyFile(
+ join(logos, 'logo-on-dark.svg'),
+ join(app, 'assets/codeimage-logo-blue-svg-v1.svg'),
+ );
+}
+
+await main();
diff --git a/scripts/brand/cards.mjs b/scripts/brand/cards.mjs
new file mode 100644
index 000000000..49b0dc529
--- /dev/null
+++ b/scripts/brand/cards.mjs
@@ -0,0 +1,132 @@
+import {readFile} from 'node:fs/promises';
+import {join} from 'node:path';
+import {dataUri, fonts} from './paths.mjs';
+
+const themes = {
+ dark: {
+ bg: '#0e0e10',
+ fg: '#f4f4f5',
+ muted: '#a1a1aa',
+ accent: '#3b9eff',
+ grid: 'rgba(255,255,255,.11)',
+ glow: [0.38, 0.3],
+ shadow: 0.7,
+ logo: 'logo-on-dark.svg',
+ },
+ light: {
+ bg: '#f1f1f1',
+ fg: '#18181b',
+ muted: '#5f5f66',
+ accent: '#0a7ad6',
+ grid: 'rgba(0,0,0,.09)',
+ glow: [0.38, 0.3],
+ shadow: 0.3,
+ logo: 'logo-on-light.svg',
+ },
+};
+
+const frameGradient =
+ 'linear-gradient(152deg, rgb(222,156,110) 0%, rgb(125,36,242) 100%)';
+
+async function fontFaces() {
+ const weights = {Medium: 500, SemiBold: 600};
+ const faces = await Promise.all(
+ Object.entries(weights).map(async ([name, weight]) => {
+ const data = (
+ await readFile(join(fonts, `Mona-Sans-${name}.woff2`))
+ ).toString('base64');
+ return `@font-face{font-family:Mona;font-weight:${weight};src:url(data:font/woff2;base64,${data})}`;
+ }),
+ );
+ return faces.join('');
+}
+
+export function terminal(lines) {
+ const escape = s => s.replace(/&/g, '&').replace(/
+ kind === 'comment'
+ ? ``
+ : `$ ${escape(text)}
`,
+ )
+ .join('');
+ return ``;
+}
+
+export async function social({
+ width,
+ height,
+ theme,
+ layout,
+ title,
+ subtitle,
+ url,
+ art,
+}) {
+ const t = themes[theme];
+ const logo = await dataUri(t.logo, 'image/svg+xml');
+ const l = layout;
+ return `
+
+
${title}
${subtitle ? `
${subtitle}
` : ''}
+${url ? `${url}
` : ''}
+${art}
`;
+}
+
+export const ogLayout = {
+ pad: 72,
+ top: 72,
+ textWidth: 440,
+ logo: 44,
+ title: 52,
+ gap: 70,
+ sub: 22,
+ subGap: 20,
+ frameX: 612,
+ frameY: 70,
+ frameW: 620,
+ framePad: 44,
+ glowX: 50,
+ glowW: 420,
+ glowH: 360,
+};
+
+export const bannerLayout = {
+ ...ogLayout,
+ top: 64,
+ title: 48,
+ gap: 40,
+ textWidth: 600,
+ frameX: 760,
+ frameY: 56,
+ frameW: 540,
+ framePad: 38,
+ glowX: 62,
+};
+
+export const socialPreviewLayout = {
+ ...ogLayout,
+ pad: 80,
+ top: 80,
+ frameX: 660,
+ frameY: 80,
+ frameW: 640,
+};
diff --git a/scripts/brand/paths.mjs b/scripts/brand/paths.mjs
new file mode 100644
index 000000000..34f5567a0
--- /dev/null
+++ b/scripts/brand/paths.mjs
@@ -0,0 +1,21 @@
+import {readFile} from 'node:fs/promises';
+import {dirname, join, resolve} from 'node:path';
+import {fileURLToPath} from 'node:url';
+
+export const root = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
+export const brand = join(root, 'assets/brand');
+export const source = join(brand, 'source');
+export const logos = join(brand, 'logos');
+export const fonts = join(root, 'apps/website/public/fonts');
+
+export const read = file =>
+ readFile(
+ join(
+ /^(mark|logo|wordmark)(-(black|white|on-dark|on-light))?\.svg$/.test(file)
+ ? logos
+ : source,
+ file,
+ ),
+ );
+export const dataUri = async (file, type) =>
+ `data:${type};base64,${(await read(file)).toString('base64')}`;