@logomarks/brand-kit 0.6.2 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to `@logomarks/brand-kit` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.0] — 2026-11-15
9
+
10
+ ### Added
11
+
12
+ - `faviconSet(brand, { icons })`: icons already drawn, by kind (`tile`, `apple`, `any`, `maskable`; `ICON_KINDS`), each
13
+ an SVG of the whole icon on its own square, rendered as it is at each of the kind's sizes in place of the mark on its
14
+ tile. A ready-made `tile` is also `favicon.svg` (unless `adaptive`) and the `.ico`. For a brand whose logo has its
15
+ own box, which the tiles' margins and corners (`ICONS`) can't draw: the Logomarks site's own icons. Kinds not handed
16
+ in are drawn as before, byte for byte.
17
+
8
18
  ## [0.6.2] — 2026-11-15
9
19
 
10
20
  ### Changed
package/docs/api.md CHANGED
@@ -79,7 +79,7 @@ One of the styles on a canvas of your own (a business card, a poster, a sleeve,
79
79
  |---|---|
80
80
  | `resolveBrand(input)` | The brand resolved: mark, palette, font, the name as outlines (`nameSet`, `nameType`), the lockups' tagline (`taglineSet`, `taglineType`, or null), `grounds`, `lockup(layout, colors)`. |
81
81
  | `resolveMarkBrand({ svg, color, name? })` | Only the mark and the palette (no name set in type, no font loaded): what `faviconSet` and `lightDarkSet` use, so they take a bare `{ svg, color }`. |
82
- | `faviconSet(brand, { small, rasterize, adaptive })` | The favicon files, for a site's root. `adaptive`: `favicon.svg` is the mark alone, in ink for the browser's light mode and paper for its dark mode (`adaptiveIcon`), not on a tile. |
82
+ | `faviconSet(brand, { small, rasterize, adaptive, icons })` | The favicon files, for a site's root. `adaptive`: `favicon.svg` is the mark alone, in ink for the browser's light mode and paper for its dark mode (`adaptiveIcon`), not on a tile. `icons`: icons already drawn, by kind (`ICON_KINDS`: `tile` for the `.ico` and `favicon.svg`, `apple`, `any`, `maskable`), each an SVG of the whole icon on its own square, rendered as it is in place of the mark on that kind's tile; for a logo that has its own box. |
83
83
  | `lightDarkSet(brand, { rasterize })` | The mark for light and dark grounds: `svg/mark-for-light.svg` (ink), `svg/mark-for-dark.svg` (paper), `svg/mark-auto.svg` (follows the reader's mode), transparent PNGs at 512, 1024 and 2048, and `preview/on-light.png` / `on-dark.png`. |
84
84
  | `markFiles`, `lockupFiles` | The mark's and lockups' files. |
85
85
  | `brandSheet(brand)` | `{ svg, png }`. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logomarks/brand-kit",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "A complete brand kit from a logomark, a name, a colour and a typeface: the mark on light, dark and colour, favicons and a real .ico, outlined lockups and a round seal, a 50-950 OKLCH palette with WCAG pairings and named swatch cards, CSS and design tokens, brand.json, a brand sheet and a guidelines deck (PNG, SVG and PDF). Plus texture-collaged and letterpress, riso or stamp-printed marks, and a social pack at every platform's current sizes in four styles, with animated SVGs and seal avatars.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -11,8 +11,19 @@ export interface FaviconOptions {
11
11
  rasterize?: Rasterize;
12
12
  /** `favicon.svg` as the mark alone, its ink following the browser's light or dark mode, instead of on a tile. */
13
13
  adaptive?: boolean;
14
+ /**
15
+ * Icons already drawn, by kind, each an SVG of the whole icon on its own square, rendered as it is in place of the
16
+ * mark on that kind's tile: `tile` (the `.ico` and `favicon.svg`), `apple` (180 px, full bleed), `any` (192 and
17
+ * 512) and `maskable` (192 and 512; keep what matters inside the centre 80%).
18
+ */
19
+ icons?: Partial<Record<IconKind, string>>;
14
20
  }
15
21
 
22
+ /** A kind of icon, as {@link ICONS} names them. */
23
+ export type IconKind = 'tile' | 'apple' | 'any' | 'maskable';
24
+ /** The kinds `icons` takes. */
25
+ export const ICON_KINDS: readonly IconKind[];
26
+
16
27
  /** How each icon is drawn. */
17
28
  export const ICONS: Readonly<{
18
29
  tile: Readonly<{ pad: number; radius: number }>;
@@ -2,7 +2,9 @@
2
2
  * Favicons and app icons: a `.ico` (16, 32, 48) and `favicon.svg` on a
3
3
  * rounded tile, the 180 px Apple touch icon (full bleed: iOS rounds it),
4
4
  * the 192 and 512 manifest icons, maskable versions with the whole mark in
5
- * the 80% safe circle, `site.webmanifest` and the `<head>` tags.
5
+ * the 80% safe circle, `site.webmanifest` and the `<head>` tags. A brand
6
+ * whose icons are already drawn (a logo with its own box, say) hands them in
7
+ * as `icons`, and they're rendered as they are.
6
8
  *
7
9
  * @module favicon/favicons
8
10
  */
@@ -25,6 +27,9 @@ export const ICONS = Object.freeze({
25
27
  maskable: Object.freeze({ circle: 0.8 }),
26
28
  });
27
29
 
30
+ /** The kinds of icon `icons` can hand in ready-made: the keys of {@link ICONS}. */
31
+ export const ICON_KINDS = Object.freeze(Object.keys(ICONS));
32
+
28
33
  /** The `.ico`'s sizes. */
29
34
  export const ICO_SIZES = Object.freeze([16, 32, 48]);
30
35
 
@@ -73,25 +78,40 @@ export const adaptiveIcon = (mark, light, dark) =>
73
78
  /**
74
79
  * The favicon set, as files for a site's root.
75
80
  *
81
+ * Each icon is the mark on a tile, drawn as {@link ICONS} says, unless
82
+ * `icons` hands that kind in ready-made: an SVG of the whole icon on its own
83
+ * square, which is then rendered as it is at each of the kind's sizes. A
84
+ * ready-made `tile` is also `favicon.svg` (unless `adaptive`) and the `.ico`,
85
+ * in place of `small`; a ready-made `maskable` should keep what matters inside
86
+ * the centre 80%.
87
+ *
76
88
  * @param {import('../brand/brand.js').BrandInput | import('../brand/brand.js').Brand} input - The brand.
77
- * @param {import('./favicons.js').FaviconOptions} [o] - A simplified mark for the small sizes, a rasteriser, and
78
- * `adaptive` for a `favicon.svg` that follows the browser's light or dark mode instead of sitting on a tile.
89
+ * @param {import('./favicons.js').FaviconOptions} [o] - A simplified mark for the small sizes, a rasteriser,
90
+ * `adaptive` for a `favicon.svg` that follows the browser's light or dark mode instead of sitting on a tile, and
91
+ * `icons`, ready-made icons by kind (`tile`, `apple`, `any`, `maskable`).
79
92
  * @returns {Promise<import('../util/files.js').FileMap>} `favicon.ico`, `favicon.svg`, the PNGs, `site.webmanifest` and `head.html`.
93
+ * @throws {Error} When `icons` names a kind that isn't one of {@link ICON_KINDS}, or one isn't SVG markup.
80
94
  */
81
- export async function faviconSet(input, { small, rasterize, adaptive = false } = {}) {
95
+ export async function faviconSet(input, { small, rasterize, adaptive = false, icons = {} } = {}) {
96
+ for (const [kind, svg] of Object.entries(icons)) {
97
+ if (!ICON_KINDS.includes(kind)) throw new Error(`brand-kit: \`icons\` takes ${ICON_KINDS.join(', ')}, not "${kind}"`);
98
+ if (typeof svg !== 'string' || !/<svg[\s>]/i.test(svg)) throw new Error(`brand-kit: \`icons.${kind}\` must be SVG markup`);
99
+ }
82
100
  const brand = resolveMarkBrand(input);
83
101
  const { mark, palette: p } = brand;
84
102
  const tiny = small ? loadMark(small) : mark;
85
103
  const icon = { color: p.onPrimary, ground: p.primary };
86
104
  const png = (/** @type {string} */ svg, /** @type {number} */ size) => toPng(svg, { width: size, height: size, rasterize });
87
105
  const maskPad = padForCircle(mark, ICONS.maskable.circle);
106
+ /** The kind's icon at a size: the ready-made one, or the mark on its tile. */
107
+ const draw = (/** @type {keyof typeof ICONS} */ kind, /** @type {number} */ size, /** @type {() => string} */ tile) => png(icons[kind] ?? tile(), size);
88
108
  const files = fileMap();
89
- files.set('favicon.ico', ico(await Promise.all(ICO_SIZES.map(async (size) => ({ size, png: await png(markTile(tiny, { size, ...icon, ...ICONS.tile }), size) })))));
90
- files.set('favicon.svg', adaptive ? adaptiveIcon(tiny, p.ink, p.paper) : markTile(tiny, { size: 32, ...icon, ...ICONS.tile }).replace(' width="32" height="32"', ''));
91
- files.set('apple-touch-icon.png', await png(markTile(mark, { size: 180, ...icon, ...ICONS.apple }), 180));
109
+ files.set('favicon.ico', ico(await Promise.all(ICO_SIZES.map(async (size) => ({ size, png: await draw('tile', size, () => markTile(tiny, { size, ...icon, ...ICONS.tile })) })))));
110
+ files.set('favicon.svg', adaptive ? adaptiveIcon(tiny, p.ink, p.paper) : icons.tile ?? markTile(tiny, { size: 32, ...icon, ...ICONS.tile }).replace(' width="32" height="32"', ''));
111
+ files.set('apple-touch-icon.png', await draw('apple', 180, () => markTile(mark, { size: 180, ...icon, ...ICONS.apple })));
92
112
  for (const size of [192, 512]) {
93
- files.set(`icon-${size}.png`, await png(markTile(mark, { size, ...icon, ...ICONS.any }), size));
94
- files.set(`icon-maskable-${size}.png`, await png(markTile(mark, { size, ...icon, pad: maskPad }), size));
113
+ files.set(`icon-${size}.png`, await draw('any', size, () => markTile(mark, { size, ...icon, ...ICONS.any })));
114
+ files.set(`icon-maskable-${size}.png`, await draw('maskable', size, () => markTile(mark, { size, ...icon, pad: maskPad })));
95
115
  }
96
116
  files.set('site.webmanifest', jsonFile(manifest(brand.name, p.primary)));
97
117
  files.set('head.html', `${HEAD_HTML}\n`);
package/src/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { sealLockup, sealOn, sealGeometry, SEAL, SEAL_DETAIL, SEAL_PRINT, SEPARA
11
11
  export { palette, pairing } from './color/palette.js';
12
12
  export { paletteCss, paletteTailwind, paletteTokens } from './color/tokens.js';
13
13
  export { swatches, swatchStack, swatchNameWidths, swatchCards, SWATCH_CARDS } from './color/swatches.js';
14
- export { faviconSet, adaptiveIcon, manifest, ICONS, ICO_SIZES, HEAD_HTML } from './favicon/favicons.js';
14
+ export { faviconSet, adaptiveIcon, manifest, ICONS, ICON_KINDS, ICO_SIZES, HEAD_HTML } from './favicon/favicons.js';
15
15
  export { ico, readIco } from './favicon/ico.js';
16
16
  export { markFiles, MARK_PNG_SIZES } from './kit/marks.js';
17
17
  export { lightDarkSet, LIGHT_DARK_PNG_SIZES } from './kit/light-dark.js';
@@ -52,7 +52,7 @@ export type { TextureOptions, TexturedMark, TexturedPiece } from './texture/text
52
52
  export type { MarkPart } from './texture/parts.js';
53
53
  export type { TextureName, Texture } from './texture/patterns.js';
54
54
  export type { Finish } from './finish/finish.js';
55
- export type { FaviconOptions } from './favicon/favicons.js';
55
+ export type { FaviconOptions, IconKind } from './favicon/favicons.js';
56
56
  export type { IcoEntry } from './favicon/ico.js';
57
57
  export type { BrandJson } from './kit/brand-json.js';
58
58
  export type { PlatformSpec, PlatformKind, Rect } from './social/platforms.js';
package/src/index.js CHANGED
@@ -16,7 +16,7 @@ export { sealLockup, sealOn, sealGeometry, SEAL, SEAL_DETAIL, SEAL_PRINT, SEPARA
16
16
  export { palette, pairing } from './color/palette.js';
17
17
  export { paletteCss, paletteTailwind, paletteTokens } from './color/tokens.js';
18
18
  export { swatches, swatchStack, swatchNameWidths, swatchCards, SWATCH_CARDS } from './color/swatches.js';
19
- export { faviconSet, adaptiveIcon, manifest, ICONS, ICO_SIZES, HEAD_HTML } from './favicon/favicons.js';
19
+ export { faviconSet, adaptiveIcon, manifest, ICONS, ICON_KINDS, ICO_SIZES, HEAD_HTML } from './favicon/favicons.js';
20
20
  export { ico, readIco } from './favicon/ico.js';
21
21
  export { markFiles, MARK_PNG_SIZES } from './kit/marks.js';
22
22
  export { lightDarkSet, LIGHT_DARK_PNG_SIZES } from './kit/light-dark.js';