@logomarks/brand-kit 0.5.1 → 0.5.3
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 +12 -0
- package/package.json +1 -1
- package/src/color/swatches.d.ts +3 -1
- package/src/color/swatches.js +28 -6
- package/src/deck/slides/palette.js +2 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/kit/sheet.js +3 -2
- package/src/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ 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.5.3] — 2026-11-12
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- A long swatch name in a wide face no longer runs into its hex ("Medium Violet Red" in Krona One). The fit measured about half an em a letter; the names are now measured from their outlines in the brand's face (`swatchNameWidths()`, exported), and the swatch cards, the brand sheet and the deck's palette slide pass them to `swatchStack` as `widths`. Without `widths` it guesses as before.
|
|
13
|
+
|
|
14
|
+
## [0.5.2] — 2026-11-07
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- The docs' and tests' example brand is an invented name (Orvane), not a real company's. No code change.
|
|
19
|
+
|
|
8
20
|
## [0.5.1] — 2026-11-07
|
|
9
21
|
|
|
10
22
|
0.5.0 was tagged but never published; install 0.5.1.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logomarks/brand-kit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
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",
|
package/src/color/swatches.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export const SWATCH_CARDS: Readonly<{ width: number; margin: number; band: numbe
|
|
|
25
25
|
/** The palette's swatches, light to dark: paper, 100, 300, the brand colour, 700, 900, ink. */
|
|
26
26
|
export function swatches(palette: Palette): Swatch[];
|
|
27
27
|
/** The swatches as stacked cards, as covers layers placed in a box (a card close to `ground` gets a hairline). */
|
|
28
|
-
export function swatchStack(brand: Brand, list: Swatch[], box: { x: number; y: number; width: number; band: number; last: number; radius: number; size?: number; ground?: string }): { layers: object[]; height: number };
|
|
28
|
+
export function swatchStack(brand: Brand, list: Swatch[], box: { x: number; y: number; width: number; band: number; last: number; radius: number; size?: number; ground?: string; widths?: number[] }): { layers: object[]; height: number };
|
|
29
|
+
/** Each swatch name's width per px of size in the brand's face (for `swatchStack`'s `widths`). */
|
|
30
|
+
export function swatchNameWidths(brand: Brand, list: Swatch[]): Promise<number[]>;
|
|
29
31
|
/** The palette as stacked swatch cards: SVG (outlines) and PNG, 1080 wide by default. */
|
|
30
32
|
export function swatchCards(brand: Brand, options?: { width?: number; rasterize?: Rasterize }): Promise<{ svg: string; png: Uint8Array; width: number; height: number; swatches: Swatch[] }>;
|
package/src/color/swatches.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { nearestColorNames, contrastRatio, formatOklch, hexToRgb, mixOklab, toOklch, pickReadable } from '@arraypress/color-utils';
|
|
10
10
|
import { createPage, renderPage } from '../util/page.js';
|
|
11
11
|
import { toPng } from '../render/png.js';
|
|
12
|
+
import { typeset, SIZE } from '../brand/type.js';
|
|
12
13
|
|
|
13
14
|
/** The cards' proportions at 1080 wide: margin, a card's visible band, the last card's height, corner radius. */
|
|
14
15
|
export const SWATCH_CARDS = Object.freeze({ width: 1080, margin: 110, band: 120, last: 260, radius: 36 });
|
|
@@ -79,15 +80,35 @@ export function swatches(p) {
|
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
/** The names' letter-spacing in the cards, in em (covers' `letterSpacing`). */
|
|
84
|
+
const NAME_TRACKING = -0.03;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Each swatch name's width per px of size in the brand's face, measured
|
|
88
|
+
* from its outlines, so a long name in a wide face ("Medium Violet Red" in
|
|
89
|
+
* Krona One) can be shrunk to clear the hex. Pass it to
|
|
90
|
+
* {@link swatchStack} as `widths`.
|
|
91
|
+
*
|
|
92
|
+
* @param {import('../brand/brand.js').Brand} brand - The brand.
|
|
93
|
+
* @param {import('./swatches.js').Swatch[]} list - The swatches.
|
|
94
|
+
* @returns {Promise<number[]>} A width per px of size, each name.
|
|
95
|
+
*/
|
|
96
|
+
export async function swatchNameWidths(brand, list) {
|
|
97
|
+
return Promise.all(list.map(async (s) => {
|
|
98
|
+
const t = await typeset(s.name, brand.font, { tracking: NAME_TRACKING * 1000, caps: false });
|
|
99
|
+
return t.box.w / SIZE;
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
|
|
82
103
|
/**
|
|
83
104
|
* The swatches as stacked cards, as covers layers on a page.
|
|
84
105
|
*
|
|
85
106
|
* @param {import('../brand/brand.js').Brand} brand - The brand.
|
|
86
107
|
* @param {import('./swatches.js').Swatch[]} list - The swatches.
|
|
87
|
-
* @param {{ x: number, y: number, width: number, band: number, last: number, radius: number, size?: number, ground?: string }} box - Where the stack goes and its proportions; `size` the names' size; the page's `ground` (a card close to it gets a hairline).
|
|
108
|
+
* @param {{ x: number, y: number, width: number, band: number, last: number, radius: number, size?: number, ground?: string, widths?: number[] }} box - Where the stack goes and its proportions; `size` the names' size; the page's `ground` (a card close to it gets a hairline); `widths`, each name's measured width per px ({@link swatchNameWidths}; else about half an em a letter).
|
|
88
109
|
* @returns {{ layers: object[], height: number }} The layers and the stack's height.
|
|
89
110
|
*/
|
|
90
|
-
export function swatchStack(brand, list, { x, y, width, band, last, radius, size = band * 0.6, ground }) {
|
|
111
|
+
export function swatchStack(brand, list, { x, y, width, band, last, radius, size = band * 0.6, ground, widths }) {
|
|
91
112
|
const page = createPage({ quiet: brand.palette.ink, line: brand.palette.ink });
|
|
92
113
|
const f = brand.font;
|
|
93
114
|
const room = width - band * 2.6;
|
|
@@ -95,9 +116,10 @@ export function swatchStack(brand, list, { x, y, width, band, last, radius, size
|
|
|
95
116
|
const top = y + i * band, h = i === list.length - 1 ? last : band + radius;
|
|
96
117
|
const faint = ground && contrastRatio(s.hex, ground) < NEAR_GROUND;
|
|
97
118
|
page.rect(x, top, width, h, s.hex, radius, faint ? mixOklab(ground, brand.palette.ink, 0.14) : undefined);
|
|
98
|
-
// Long names shrink to the room left of the hex
|
|
99
|
-
const
|
|
100
|
-
|
|
119
|
+
// Long names shrink to the room left of the hex: measured in the face when `widths` is given, else about half an em a letter.
|
|
120
|
+
const per = widths?.[i] ?? s.name.length * 0.52;
|
|
121
|
+
const fit = Math.min(size, room / Math.max(0.01, per));
|
|
122
|
+
page.text(x + band * 0.33, top + band * 0.33 + fit * 0.72, s.name, { size: Math.floor(fit), font: f.name, weight: f.weight, letterSpacing: NAME_TRACKING, color: s.text });
|
|
101
123
|
page.text(x + width - band * 0.27, top + band * 0.4, s.hex.toUpperCase(), { size: Math.round(band * 0.2), weight: 500, color: s.text, align: 'right' });
|
|
102
124
|
page.label(x + width - band * 0.27, top + band * 0.68, s.role, s.text, { size: Math.round(band * 0.12), align: 'right' });
|
|
103
125
|
});
|
|
@@ -115,7 +137,7 @@ export async function swatchCards(brand, { width = SWATCH_CARDS.width, rasterize
|
|
|
115
137
|
const k = width / SWATCH_CARDS.width, S = SWATCH_CARDS;
|
|
116
138
|
const list = swatches(brand.palette);
|
|
117
139
|
const margin = S.margin * k;
|
|
118
|
-
const stack = swatchStack(brand, list, { x: margin, y: margin, width: width - 2 * margin, band: S.band * k, last: S.last * k, radius: S.radius * k });
|
|
140
|
+
const stack = swatchStack(brand, list, { x: margin, y: margin, width: width - 2 * margin, band: S.band * k, last: S.last * k, radius: S.radius * k, widths: await swatchNameWidths(brand, list) });
|
|
119
141
|
const height = Math.round(stack.height + 2 * margin);
|
|
120
142
|
const svg = await renderPage(brand, stack.layers, { width, height, ground: mixOklab(brand.palette.paper, brand.palette.ink, 0.1) });
|
|
121
143
|
return { svg, png: await toPng(svg, { width, height, rasterize }), width, height, swatches: list };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module deck/slides/palette
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { swatches, swatchStack } from '../../color/swatches.js';
|
|
8
|
+
import { swatches, swatchStack, swatchNameWidths } from '../../color/swatches.js';
|
|
9
9
|
import { DECK, slide, display } from '../frame.js';
|
|
10
10
|
|
|
11
11
|
/** @type {import('../index.js').DeckSlide} */
|
|
@@ -17,7 +17,7 @@ export const palette = {
|
|
|
17
17
|
const { page, quiet, line } = slide(brand, { ground: p.paper, text: p.ink, title: 'Palette', n, total });
|
|
18
18
|
const list = swatches(p), top = 150, room = H - top - M;
|
|
19
19
|
const band = Math.round((room - 220) / (list.length - 1));
|
|
20
|
-
const stack = swatchStack(brand, list, { x: M, y: top, width: 800, band, last: room - band * (list.length - 1), radius: 28, size: 56, ground: p.paper });
|
|
20
|
+
const stack = swatchStack(brand, list, { x: M, y: top, width: 800, band, last: room - band * (list.length - 1), radius: 28, size: 56, ground: p.paper, widths: await swatchNameWidths(brand, list) });
|
|
21
21
|
page.layers.push(...stack.layers);
|
|
22
22
|
const rx = M + 800 + 120, rw = W - M - rx;
|
|
23
23
|
page.text(rx, 250, 'Pairings', display(brand, 52, p.ink));
|
package/src/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { lockup, LOCKUP, LAYOUTS } from './lockup/lockup.js';
|
|
|
10
10
|
export { sealLockup, sealOn, sealGeometry, SEAL, SEAL_DETAIL, SEAL_PRINT, SEPARATORS } from './lockup/seal.js';
|
|
11
11
|
export { palette, pairing } from './color/palette.js';
|
|
12
12
|
export { paletteCss, paletteTailwind, paletteTokens } from './color/tokens.js';
|
|
13
|
-
export { swatches, swatchStack, swatchCards, SWATCH_CARDS } from './color/swatches.js';
|
|
13
|
+
export { swatches, swatchStack, swatchNameWidths, swatchCards, SWATCH_CARDS } from './color/swatches.js';
|
|
14
14
|
export { faviconSet, manifest, ICONS, 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';
|
package/src/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { lockup, LOCKUP, LAYOUTS } from './lockup/lockup.js';
|
|
|
15
15
|
export { sealLockup, sealOn, sealGeometry, SEAL, SEAL_DETAIL, SEAL_PRINT, SEPARATORS } from './lockup/seal.js';
|
|
16
16
|
export { palette, pairing } from './color/palette.js';
|
|
17
17
|
export { paletteCss, paletteTailwind, paletteTokens } from './color/tokens.js';
|
|
18
|
-
export { swatches, swatchStack, swatchCards, SWATCH_CARDS } from './color/swatches.js';
|
|
18
|
+
export { swatches, swatchStack, swatchNameWidths, swatchCards, SWATCH_CARDS } from './color/swatches.js';
|
|
19
19
|
export { faviconSet, manifest, ICONS, 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';
|
package/src/kit/sheet.js
CHANGED
|
@@ -21,7 +21,7 @@ import { artwork, artworkSpec } from '../social/artwork.js';
|
|
|
21
21
|
import { muted, tone } from '../social/styles/tone.js';
|
|
22
22
|
import { nest, prefixIds } from '../util/svg.js';
|
|
23
23
|
import { createPage, renderPage } from '../util/page.js';
|
|
24
|
-
import { swatches, swatchStack } from '../color/swatches.js';
|
|
24
|
+
import { swatches, swatchStack, swatchNameWidths } from '../color/swatches.js';
|
|
25
25
|
import { sealOn } from '../lockup/seal.js';
|
|
26
26
|
import { toPng } from '../render/png.js';
|
|
27
27
|
|
|
@@ -134,7 +134,8 @@ async function compose(brand) {
|
|
|
134
134
|
];
|
|
135
135
|
// The named swatches stacked on the left, the roles and their contrast in a grid on the right.
|
|
136
136
|
const stackW = Math.round(INNER * 0.44);
|
|
137
|
-
const
|
|
137
|
+
const list = swatches(p);
|
|
138
|
+
const stack = swatchStack(brand, list, { x: M, y, width: stackW, band: 66, last: 150, radius: 20, size: 34, ground: p.paper, widths: await swatchNameWidths(brand, list) });
|
|
138
139
|
layers.push(...stack.layers);
|
|
139
140
|
const cw = (INNER - stackW - 2 * G) / 2, ch = (stack.height - G) / 2;
|
|
140
141
|
roles.forEach((c, i) => {
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This library's version, written into `brand.json`. */
|
|
2
|
-
export const VERSION = '0.5.
|
|
2
|
+
export const VERSION = '0.5.3';
|