headreel 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { fitIdentity } from '../../core/text.js';
1
2
  import { LAYOUT, RINGS } from './galaxy.js';
2
3
  const PALETTE = {
3
4
  skyTop: '#060914',
@@ -57,6 +58,13 @@ function truncate(text, max) {
57
58
  }
58
59
  export function createGalaxySketch(galaxy, identity, login, rng) {
59
60
  const grainSeed = Math.floor(rng() * 2 ** 31);
61
+ // Everything in the text column stops short of the outer orbit's dial.
62
+ const column = CX - RINGS[RINGS.length - 1].rx - 24 - TEXT_X;
63
+ const fitted = fitIdentity({
64
+ name: identity.name.toUpperCase(),
65
+ tagline: identity.tagline,
66
+ website: identity.website && `↗ ${displayUrl(identity.website)}`,
67
+ }, column);
60
68
  let sky;
61
69
  let grain;
62
70
  function renderSky(p) {
@@ -332,16 +340,16 @@ export function createGalaxySketch(galaxy, identity, login, rng) {
332
340
  }
333
341
  p.textFont(SANS);
334
342
  p.textStyle(p.BOLD);
335
- p.textSize(50);
343
+ p.textSize(fitted.name.size);
336
344
  ctx.letterSpacing = '3px';
337
345
  p.fill(PALETTE.ink);
338
- p.text(identity.name.toUpperCase(), x, 116);
346
+ p.text(fitted.name.text, x, 116);
339
347
  ctx.letterSpacing = '0px';
340
- if (identity.tagline) {
348
+ if (fitted.tagline) {
341
349
  p.textStyle(p.NORMAL);
342
- p.textSize(17);
350
+ p.textSize(fitted.tagline.size);
343
351
  p.fill(...brass);
344
- p.text(identity.tagline, x, 146);
352
+ p.text(fitted.tagline.text, x, 146);
345
353
  }
346
354
  const count = galaxy.planets.length;
347
355
  p.textFont(MONO);
@@ -371,10 +379,10 @@ export function createGalaxySketch(galaxy, identity, login, rng) {
371
379
  p.text(label, lx + 14, 296);
372
380
  lx += 14 + p.textWidth(label) + 18;
373
381
  }
374
- if (identity.website) {
375
- p.textSize(12);
382
+ if (fitted.website) {
383
+ p.textSize(fitted.website.size);
376
384
  p.fill(...brass);
377
- p.text(`↗ ${displayUrl(identity.website)}`, x, 350);
385
+ p.text(fitted.website.text, x, 350);
378
386
  }
379
387
  }
380
388
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "headreel",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Animated GitHub profile banner made from your GitHub activity, with a GitHub Action or CLI.",
5
5
  "keywords": [
6
6
  "github",