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
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
* text=auto eol=lf
*.png binary
*.ttf binary

# Generated: review the source instead.
lua/mistpine/palette.lua linguist-generated
Expand Down
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
# @mistpine/port-kit and its reusable workflow; other updates are by hand.
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
allow:
- dependency-name: "@mistpine/port-kit"
commit-message:
prefix: build
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
allow:
- dependency-name: "mistpine/port-kit*"
commit-message:
prefix: ci
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: 2.5.2
args: --check .
- uses: actions/setup-node@v7
with:
node-version: 24
- run: corepack enable
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck

# The banner and render scripts: pnpm lint and typecheck.
scripts:
uses: mistpine/port-kit/.github/workflows/port.yml@v0.1.0
with:
check: false
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ make images # README images (pnpm install first; Node 24+, Chromium)
[`palette/mistpine.json`](https://github.com/mistpine/mistpine/blob/main/palette/mistpine.json);
change colors upstream, then sync. Screenshots come from a real Neovim: `pnpm render` runs
an isolated LazyVim under `nvim --embed` and draws its screen in Chromium.
The banner comes from
[@mistpine/port-kit](https://github.com/mistpine/port-kit), shared by every mistpine port.

## License

[MIT](LICENSE). Outfit and JetBrains Mono (in `scripts/fonts`, for the banner) are under the
SIL Open Font License 1.1.
[MIT](LICENSE).
23 changes: 1 addition & 22 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"extends": ["@mistpine/port-kit/biome"],
"files": {
"includes": ["**", "!**/assets", "!**/*.md", "!**/*.lua", "!scripts/render/sample", "!.cache"]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"linter": {
"rules": {
"preset": "recommended"
}
},
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
},
"devDependencies": {
"@biomejs/biome": "^2.6.5",
"@mistpine/port-kit": "^0.1.0",
"@msgpack/msgpack": "^3.1.3",
"@types/node": "^26.6.6",
"harfbuzzjs": "^1.6.4",
"playwright-core": "^1.64.1",
"typescript": "^7.0.2"
}
Expand Down
15 changes: 12 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 14 additions & 90 deletions scripts/banner.ts
Original file line number Diff line number Diff line change
@@ -1,99 +1,23 @@
/**
* Writes the README banner and the GitHub social preview, after the
* "Port banner A · centered lockup" board of the mistpine logos canvas:
* the mark and `mistpine.nvim` centered on the editor background, over a
* band of the accents.
* Writes the README banner and the GitHub social preview with
* @mistpine/port-kit: the mistpine lockup with the `.nvim` suffix in
* brightGreen (docs/brand.md in mistpine/mistpine).
*
* pnpm banner
*
* Text is outlined with HarfBuzz (scripts/lib/text.ts), so the SVGs need no
* fonts. The PNG is drawn by Chromium (CHROMIUM overrides playwright's).
* The colors come from the colorscheme itself (lib/colors.ts). The PNG is
* drawn by Chromium (CHROMIUM overrides playwright's).
*/
import { writeFileSync } from "node:fs";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
import { chromium } from "playwright-core";
import { writeBanners } from "@mistpine/port-kit/banner";
import { loadColors, ROOT } from "./lib/colors.ts";
import { num, shape, type TextStyle, textPath } from "./lib/text.ts";

const { palette: p, ansi } = loadColors();
const c = (key: string) => {
const v = p[key];
if (!v) throw new Error(`palette has no ${key}`);
return v;
};

const [W, H, BAND] = [1280, 640, 10];
const MARK = 180;
const GAP = 36;
const WORD: TextStyle = { family: "outfit", size: 104, weight: 300, tracking: -0.03 };
const SUFFIX: TextStyle = { family: "mono", size: 80, weight: 300, tracking: -0.02 };
/** The suffix color for mistpine.nvim (docs/brand.md in mistpine/mistpine). */
const ACCENT = c("brightGreen");

/** The mark (120 × 120 units): three pines with fog between them. */
function mark(x: number, y: number, size: number): string {
const wave = "q7 -5 14 0 t14 0 t14 0 t14 0 t14 0";
const fog = (d: string, color: string) =>
`<path d="${d}" fill="none" stroke="${color}" stroke-width="4.5" stroke-linecap="round"/>`;
const pine = (d: string, color: string) => `<path d="${d}" fill="${color}"/>`;
return `<g transform="translate(${num(x)} ${num(y)}) scale(${num(size / 120)})">${[
pine("M60 8 L84 76 L36 76 Z", c("fg0")),
fog(`M34 64 ${wave}`, c("bg4")),
pine("M80 30 L104 98 L56 98 Z", c("fg1")),
fog(`M44 86 ${wave}`, c("fg2")),
pine("M38 38 L64 110 L12 110 Z", c("brightCyan")),
fog(`M4 98 ${wave}`, c("fg3")),
].join("")}</g>`;
}

function banner(rounded: boolean): string {
const word = shape("mistpine", WORD);
const suffix = shape(".nvim", SUFFIX);
// CSS letter spacing also follows the last letter of each run.
const wordAdvance = word.width + (WORD.tracking ?? 0) * WORD.size;
const textW = wordAdvance + suffix.width + (SUFFIX.tracking ?? 0) * SUFFIX.size;
const x0 = (W - (MARK + GAP + textW)) / 2;
const cy = (H - BAND) / 2;
// Center the line box both runs share, as flexbox does.
const ascent = Math.max(word.ascent, suffix.ascent);
const descent = Math.max(word.descent, suffix.descent);
const baseline = cy - (ascent + descent) / 2 + ascent;
const tx = x0 + MARK + GAP;

const accents = ["red", "orange", "yellow", "green", "cyan", "blue", "purple"].map(c);
const band = [...accents, ansi[5] as string, c("pink")];
const segment = W / band.length;
const stripes = band
.map(
(color, i) =>
`<rect x="${num(i * segment)}" y="${H - BAND}" width="${num(segment + 0.5)}" height="${BAND}" fill="${color}"/>`,
)
.join("");

const label = "mistpine.nvim: the mistpine color scheme for Neovim";
const card = `<rect width="${W}" height="${H}" fill="${c("bg1")}"/>${stripes}`;
const body = [
rounded
? `<defs><clipPath id="card"><rect width="${W}" height="${H}" rx="24"/></clipPath></defs><g clip-path="url(#card)">${card}</g>`
: card,
mark(x0, cy - MARK / 2, MARK),
textPath("mistpine", WORD, tx, baseline, c("fg3")),
textPath(".nvim", SUFFIX, tx + wordAdvance, baseline, ACCENT),
].join("");
return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" role="img" aria-label="${label}"><title>${label}</title>${body}</svg>\n`;
}

const assets = join(ROOT, "assets");
writeFileSync(join(assets, "banner.svg"), banner(true));
writeFileSync(join(assets, "social-preview.svg"), banner(false));

const browser = await chromium.launch({ executablePath: process.env.CHROMIUM || undefined });
try {
const page = await browser.newPage({ viewport: { width: W, height: H } });
await page.goto(pathToFileURL(join(assets, "social-preview.svg")).href);
await page.screenshot({ path: join(assets, "social-preview.png") });
} finally {
await browser.close();
}
const { palette, ansi } = loadColors();
await writeBanners(join(ROOT, "assets"), {
palette,
ansi,
suffix: ".nvim",
accent: "brightGreen",
label: "mistpine.nvim: the mistpine color scheme for Neovim",
});
console.log("wrote assets/banner.svg, assets/social-preview.svg, assets/social-preview.png");
Binary file removed scripts/fonts/JetBrainsMono-wght.ttf
Binary file not shown.
93 changes: 0 additions & 93 deletions scripts/fonts/OFL-JetBrainsMono.txt

This file was deleted.

Loading
Loading