Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions brand/scripts/generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const paint = (t) => ({
paper: hex(t['mark-paper']),
line: hex(t['mark-line']),
brand: hex(t.brand),
cut: hex(t.surface),
on: hex(t['on-brand']),
cut: hex(t['mark-cut']),
});
const ink = (t) => ({ word: hex(t.ink), beam: hex(t['brand-ink']) });

Expand All @@ -62,15 +63,15 @@ function lockup(id, t) {

// One file that follows the browser's colour scheme, for the tab icon.
function adaptiveFavicon(id) {
const roles = ['paper', 'line', 'brand', 'cut'];
const roles = ['paper', 'line', 'brand', 'on', 'cut'];
const vars = Object.fromEntries(roles.map((r) => [r, `var(--${r})`]));
const decl = (t) => roles.map((r) => `--${r}:${paint(t)[r]}`).join(';');
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><style>svg{${decl(light)}}@media (prefers-color-scheme:dark){svg{${decl(dark)}}}</style>${marks[id].draw(vars)}</svg>`;
}

function card(label, width = 1200, height = 630) {
const w = wordmark(300, 262, 108, { word: hex(light['band-dark-ink']), beam: hex(light['band-dark-brand']) });
const mark = `<g transform="translate(96 150) scale(2.9)">${marks[PRIMARY].draw(paint(light))}</g>`;
const mark = `<g transform="translate(96 150) scale(2.9)">${marks[PRIMARY].draw({ ...paint(dark), cut: hex(light['band-dark']) })}</g>`;
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
<rect width="${width}" height="${height}" fill="${hex(light['band-dark'])}"/>
<rect x="0" y="${height - 10}" width="${width}" height="10" fill="${hex(light.brand)}"/>
Expand Down
21 changes: 13 additions & 8 deletions brand/src/marks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
* with literal colours in exported files.
*
* Roles: paper (the page), line (text lines), brand (margin bar, beam, rays),
* cut (the ground behind the mark, used to separate the beam from the page).
* on (the line the beam lights), cut (the ground behind the mark, used to
* separate the beam from the page).
*/

export const cssPaint = {
paper: 'var(--mark-paper)',
line: 'var(--mark-line)',
brand: 'var(--brand)',
cut: 'var(--surface)',
on: 'var(--on-brand)',
cut: 'var(--mark-cut)',
};

// B9: the margin bar is 12 tall on y 22..34; the beam is 80% of it, centred
Expand All @@ -21,7 +23,6 @@ const BEAM_H = BAR.h * 0.8;
const BEAM_Y = BAR.y + (BAR.h - BEAM_H) / 2;
const BEAM_END = 62;
const BEAM_R = 1.5;
const BEAM_OPACITY = 0.28;

function beamPath() {
const x0 = BAR.x + BAR.w;
Expand All @@ -31,15 +32,19 @@ function beamPath() {
return `M${x0} ${f(BEAM_Y)} H${BEAM_END - r} A${r} ${r} 0 0 1 ${BEAM_END} ${f(BEAM_Y + r)} V${f(y1 - r)} A${r} ${r} 0 0 1 ${BEAM_END - r} ${f(y1)} H${x0} Z`;
}

// The page is solid and every line is fully opaque, so the mark stays sharp at
// favicon size. The beam is outlined in the ground colour where it crosses the
// page, which separates the two whatever their contrast, and the line it lights
// is drawn over it.
const b9 = (p) =>
[
`<rect x="14" y="6" width="44" height="52" rx="8" fill="${p.paper}"/>`,
`<rect x="22" y="15" width="28" height="4" rx="2" fill="${p.line}" opacity="0.3"/>`,
`<rect x="22" y="26" width="22" height="4" rx="2" fill="${p.line}"/>`,
`<rect x="22" y="37" width="26" height="4" rx="2" fill="${p.line}" opacity="0.3"/>`,
`<rect x="22" y="47" width="18" height="4" rx="2" fill="${p.line}" opacity="0.3"/>`,
`<rect x="22" y="14" width="28" height="4" rx="2" fill="${p.line}"/>`,
`<rect x="22" y="40" width="26" height="4" rx="2" fill="${p.line}"/>`,
`<rect x="22" y="48" width="18" height="4" rx="2" fill="${p.line}"/>`,
`<rect x="${BAR.x}" y="${BAR.y}" width="${BAR.w}" height="${BAR.h}" rx="2.5" fill="${p.brand}"/>`,
`<path d="${beamPath()}" fill="${p.brand}" opacity="${BEAM_OPACITY}"/>`,
`<path d="${beamPath()}" fill="${p.brand}" stroke="${p.cut}" stroke-width="1.5" paint-order="stroke"/>`,
`<rect x="22" y="26" width="22" height="4" rx="2" fill="${p.on}"/>`,
].join('');

const c2 = (p) =>
Expand Down
3 changes: 3 additions & 0 deletions brand/src/pairs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ export const markPairs = [
['brand', 'ground'],
['brand', 'band-dark'],
['mark-line', 'mark-paper'],
['mark-paper', 'ground'],
['mark-paper', 'surface'],
['on-brand', 'brand'],
];
26 changes: 14 additions & 12 deletions brand/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
:root {
color-scheme: light;

--ground: oklch(98.5% 0.003 265);
--surface: oklch(100% 0 0);
--surface-sunken: oklch(96.2% 0.006 265);
--line: oklch(90% 0.008 265);
--ink: oklch(23% 0.017 265);
--ink-muted: oklch(47% 0.017 265);
--ground: oklch(96.4% 0.008 265);
--surface: oklch(98.4% 0.005 265);
--surface-sunken: oklch(94.4% 0.009 265);
--line: oklch(87.5% 0.01 265);
--ink: oklch(20.5% 0.018 265);
--ink-muted: oklch(43% 0.018 265);

--brand: oklch(55.5% 0.215 345);
--on-brand: oklch(100% 0 0);
Expand All @@ -24,15 +24,16 @@
--band-dark-line: oklch(32% 0.018 265);
--band-dark-raised: oklch(26.5% 0.02 265);
--band-dark-brand: oklch(78% 0.14 345);
--band-mist: oklch(94.5% 0.006 265);
--band-mist: oklch(92.8% 0.01 265);

--hero-from: oklch(24% 0.02 265);
--hero-to: oklch(50% 0.2 348);
--on-hero: oklch(100% 0 0);
--hero-well: oklch(0% 0 0 / 0.24);

--mark-paper: oklch(93% 0.008 265);
--mark-line: oklch(28% 0.025 265);
--mark-paper: oklch(25% 0.022 265);
--mark-line: oklch(97% 0.005 265);
--mark-cut: oklch(96.4% 0.008 265);

--proven-ink: oklch(50% 0.19 27);
--proven-soft: oklch(95.5% 0.028 27);
Expand Down Expand Up @@ -65,7 +66,7 @@
--term-blue: oklch(76% 0.11 250);
--term-green: oklch(80% 0.15 150);

--glass: oklch(100% 0 0 / 0.8);
--glass: oklch(96.4% 0.008 265 / 0.86);

--elevation-1: 0 1px 2px 0 rgb(0 0 0 / 0.03), 0 1px 3px 1px rgb(0 0 0 / 0.04);
--elevation-2: 0 1px 2px 0 rgb(0 0 0 / 0.03), 0 2px 6px 2px rgb(0 0 0 / 0.06);
Expand Down Expand Up @@ -121,8 +122,9 @@
--band-dark-brand: oklch(78% 0.14 345);
--band-mist: oklch(26% 0.014 265);

--mark-paper: oklch(32% 0.02 265);
--mark-line: oklch(93% 0.01 265);
--mark-paper: oklch(95% 0.008 265);
--mark-line: oklch(24% 0.02 265);
--mark-cut: oklch(20.5% 0.013 265);

--proven-ink: oklch(80% 0.12 27);
--proven-soft: oklch(30% 0.075 27);
Expand Down
1 change: 1 addition & 0 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
"not_found_handling": "404-page",
},
"routes": [{ "pattern": "docs.pagebeam.dev", "custom_domain": true }],
"previews": {},
}
Loading