@logomarks/lookbook 0.1.2 → 0.2.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 +26 -0
- package/README.md +2 -2
- package/package.json +5 -2
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/live.js +7 -4
- package/src/styles/wall.css +29 -3
- package/src/wall.d.ts +16 -1
- package/src/wall.js +84 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ All notable changes to `@logomarks/lookbook` 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.2.0] — 2026-11-20
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **ASCII noise** (`asciinoise`): a card on a field of drifting type, soft-edged blobs of characters panning and
|
|
13
|
+
morphing (@arraypress/effects-astro 0.10's `asciiNoise`, started on screen like a shader card, ten at a time), the
|
|
14
|
+
lockup in the wall's monospaced face in a quiet middle. Six colourways (graphite, acid, phosphor, cobalt, paper,
|
|
15
|
+
signal), six ramps, two cell sizes; its first frame is laid as SVG text, the cells the shader starts on, so the card
|
|
16
|
+
shows the field before it starts, without WebGL and under reduced motion. After a Processing sketch shared with the
|
|
17
|
+
owner (`ascii_noise_bg`).
|
|
18
|
+
- **`lookbook({ weights })`**: how often looks are dealt, over `WEIGHTS`. ASCII noise is at 0 unless a wall gives it a
|
|
19
|
+
weight, so a wall without one deals exactly the cards it did (the equivalence fixture is untouched).
|
|
20
|
+
- **`KIND_LABEL`**: names for the looks whose id doesn't read as one (`asciinoise` → "ASCII noise").
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
|
|
24
|
+
- `@arraypress/effects-astro` ^0.10.0 (for `runtime/ascii-noise`).
|
|
25
|
+
|
|
26
|
+
## [0.1.3] — 2026-11-18
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **`lookbook({ palettes })`**: more grounds and inks for the colour cards, `[ground, ink]`, dealt after the built-in twelve.
|
|
31
|
+
Default none, so a wall without them deals exactly the cards it did (the equivalence fixture is untouched). The site uses
|
|
32
|
+
it for the owner's modern set (flat, saturated grounds with the mark in black or white).
|
|
33
|
+
|
|
8
34
|
## [0.1.2] — 2026-11-15
|
|
9
35
|
|
|
10
36
|
### Changed
|
package/README.md
CHANGED
|
@@ -37,10 +37,10 @@ holoPointer();
|
|
|
37
37
|
|
|
38
38
|
## What's in it
|
|
39
39
|
|
|
40
|
-
- `@logomarks/lookbook`: `lookbook({ brand, faces, accent?, href?, skip? })` gives `card`, `feed` and `backgrounds
|
|
40
|
+
- `@logomarks/lookbook`: `lookbook({ brand, faces, accent?, palettes?, weights?, href?, skip? })` gives `card`, `feed` and `backgrounds` (`weights: { asciinoise: 1 }` deals the ASCII noise card, a field of drifting monospaced type, which is otherwise off); `shuffled`; the promo cards `headlineCard`, `sponsorCard`, `openSlotCard`; `WEIGHTS`, `KIND_LABEL`, `EVERY`, `ACCENT` (`#C8FF00`) and the look tables.
|
|
41
41
|
- `@logomarks/lookbook/looks`: the drawn looks, `LOOK_KINDS`, `LOOK_LABEL`, `LOOK_LOOP` (each moving look's loop, for a video), `LOOK_RATIO`, `LOOK_WEIGHTS`, `retarget` (another mark on a card) and `refit`.
|
|
42
42
|
- `@logomarks/lookbook/marks`: a mark's box, ink share, optical size (`opticalVars`), cells and heat field; the box, ink, size and cells are `@logomarks/core`'s, re-exported.
|
|
43
|
-
- `@logomarks/lookbook/live`: `liveCards`, `shaders
|
|
43
|
+
- `@logomarks/lookbook/live`: `liveCards`, `shaders` (Paper's shaders and the ASCII noise field), `smoke` with its presets `SMOKE`, and `holoPointer`.
|
|
44
44
|
- `wall.css` and `wall-looks.css`: the cards and the drawn looks. They read the page's theme tokens (`--text`, `--muted`, `--border`, `--surface`, `--display`, `--mono`) and the accent `--hi`.
|
|
45
45
|
|
|
46
46
|
The pictures go by their file names: `club-N` the club hall, `club-dancer-N` and `club-crowd-N` its people, portraits (`modern`, `y2k` …) and the rest in `photos`; flowers (`bloom-N`, `dahlia-N`, `iris-N`, `lily-N`, `marigold-N`, `palm-N`) and abstracts in `glass`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logomarks/lookbook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A logomark dressed as a made-up brand, in sixty-odd looks: on a photo, glass, a colour, paper or a live gradient, or the mark itself redrawn (traced, constructed, reeded, pixelated, neon, split-flap, contoured, thermal, liquid chrome, holo foil, ASCII, embroidered, frosted, editorial and more). Pure functions returning HTML, the same on the server and in the browser, with their CSS (motion in CSS only, a still final frame, a Plain mode), an optical size for wide, slim or light marks, and a browser runner that starts only what's near the screen.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"registry": "https://registry.npmjs.org/"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@arraypress/effects-astro": "^0.
|
|
78
|
+
"@arraypress/effects-astro": "^0.10.0",
|
|
79
79
|
"@arraypress/og-image": "^1.5.1",
|
|
80
80
|
"@arraypress/text": "^2.2.0",
|
|
81
81
|
"@logomarks/core": "^0.2.1"
|
|
@@ -83,5 +83,8 @@
|
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/node": "^26.6.6",
|
|
85
85
|
"typescript": "^6.0.3"
|
|
86
|
+
},
|
|
87
|
+
"overrides": {
|
|
88
|
+
"fflate": "0.7.5"
|
|
86
89
|
}
|
|
87
90
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `@logomarks/lookbook/live`; the styles are `@logomarks/lookbook/wall.css` and `@logomarks/lookbook/wall-looks.css`.
|
|
8
8
|
*/
|
|
9
9
|
/** The wall: `lookbook()` (its cards and feed), `shuffled`, the accent, the looks' weights and how often a promo card comes. */
|
|
10
|
-
export { ACCENT, EVERY, WEIGHTS, lookbook, shuffled } from './wall.js';
|
|
10
|
+
export { ACCENT, EVERY, KIND_LABEL, WEIGHTS, lookbook, shuffled } from './wall.js';
|
|
11
11
|
export type { Brand, BrandPicker, Card, Face, Kind, Lookbook, LookbookOptions, Recent, WallAssets, WallMark } from './wall.js';
|
|
12
12
|
/** The cards between the marks. */
|
|
13
13
|
export { headlineCard, sponsorCard, openSlotCard } from './promo.js';
|
package/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/** The wall: `lookbook()` (its cards and feed), `shuffled`, the accent, the looks' weights and how often a promo card comes. */
|
|
11
|
-
export { ACCENT, EVERY, WEIGHTS, lookbook, shuffled } from './wall.js';
|
|
11
|
+
export { ACCENT, EVERY, KIND_LABEL, WEIGHTS, lookbook, shuffled } from './wall.js';
|
|
12
12
|
|
|
13
13
|
/** The cards between the marks. */
|
|
14
14
|
export { headlineCard, sponsorCard, openSlotCard } from './promo.js';
|
package/src/live.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { ink } from '@arraypress/effects-astro/runtime/ink';
|
|
11
11
|
import { paperShader } from '@arraypress/effects-astro/runtime/paper';
|
|
12
|
+
import { asciiNoise } from '@arraypress/effects-astro/runtime/ascii-noise';
|
|
12
13
|
import { whenNear } from '@arraypress/effects-astro/runtime/near';
|
|
13
14
|
import { budget } from '@arraypress/effects-astro/runtime/budget';
|
|
14
15
|
|
|
@@ -40,9 +41,10 @@ export function smoke(el, options = {}) {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
|
-
* A starter for the shader and
|
|
44
|
-
* in effects-astro), at most `cap` at once (a browser drops the oldest WebGL context
|
|
45
|
-
* card's canvas goes blank). Without WebGL, or with a bad config, the card keeps its
|
|
44
|
+
* A starter for the shader, gradient and ASCII noise cards: each card's live background (its `data-shader` config, Paper's
|
|
45
|
+
* shaders or the ASCII noise field in effects-astro), at most `cap` at once (a browser drops the oldest WebGL context
|
|
46
|
+
* past about sixteen, and a dropped card's canvas goes blank). Without WebGL, or with a bad config, the card keeps its
|
|
47
|
+
* still background.
|
|
46
48
|
*
|
|
47
49
|
* @param cap The most running at once (10).
|
|
48
50
|
* @returns Starts a card; what it returns stops it (or gives up its place in the queue).
|
|
@@ -52,7 +54,8 @@ export function shaders(cap = 10) {
|
|
|
52
54
|
return (card) => {
|
|
53
55
|
try {
|
|
54
56
|
const config = JSON.parse(card.dataset.shader ?? '{}');
|
|
55
|
-
|
|
57
|
+
// an ASCII noise card's field is effects-astro's own; the rest are Paper's shaders
|
|
58
|
+
return take(card, () => (config.effect === 'ascii-noise' ? asciiNoise(card, config) : paperShader(card, config)));
|
|
56
59
|
} catch {
|
|
57
60
|
return () => {}; // no WebGL: the card keeps its still look
|
|
58
61
|
}
|
package/src/styles/wall.css
CHANGED
|
@@ -754,6 +754,29 @@
|
|
|
754
754
|
text-shadow: 0 2px 24px rgb(0 0 0 / 0.2);
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
+
/* ASCII noise cards: a field of drifting type (effects-astro's asciiNoise) on a flat ground, the lockup in a monospaced
|
|
758
|
+
face in the quiet middle. Its first frame is text (.wc-noise, the cells the shader starts on); the shader's canvas
|
|
759
|
+
paints the ground too, so it fades in over the text like a shader card over its still */
|
|
760
|
+
.wc-asciinoise {
|
|
761
|
+
background: var(--bg);
|
|
762
|
+
color: var(--fg);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.wc-noise {
|
|
766
|
+
position: absolute;
|
|
767
|
+
inset: 0;
|
|
768
|
+
z-index: -1;
|
|
769
|
+
width: 100%;
|
|
770
|
+
height: 100%;
|
|
771
|
+
dominant-baseline: central;
|
|
772
|
+
font-kerning: none;
|
|
773
|
+
font-variant-ligatures: none;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.wc-asciinoise .wc-lockup {
|
|
777
|
+
color: var(--fg);
|
|
778
|
+
}
|
|
779
|
+
|
|
757
780
|
/* smoke in the sponsor cards (the page's script): behind the words */
|
|
758
781
|
.wc-smoke {
|
|
759
782
|
position: absolute;
|
|
@@ -1100,19 +1123,22 @@
|
|
|
1100
1123
|
/* gradient and shader cards: the live picture fades in over the still one (same colours; under the grain on a gradient
|
|
1101
1124
|
card), so a card never pops from one to the other as it comes near the screen */
|
|
1102
1125
|
.wc-gradient .wc-fx,
|
|
1103
|
-
.wc-shader .wc-fx
|
|
1126
|
+
.wc-shader .wc-fx,
|
|
1127
|
+
.wc-asciinoise .wc-fx {
|
|
1104
1128
|
opacity: 0;
|
|
1105
1129
|
transition: opacity 1.4s ease;
|
|
1106
1130
|
}
|
|
1107
1131
|
|
|
1108
1132
|
.wc-gradient[data-effect-live] .wc-fx,
|
|
1109
|
-
.wc-shader[data-effect-live] .wc-fx
|
|
1133
|
+
.wc-shader[data-effect-live] .wc-fx,
|
|
1134
|
+
.wc-asciinoise[data-effect-live] .wc-fx {
|
|
1110
1135
|
opacity: 1;
|
|
1111
1136
|
}
|
|
1112
1137
|
|
|
1113
1138
|
@media (prefers-reduced-motion: reduce) {
|
|
1114
1139
|
.wc-gradient .wc-fx,
|
|
1115
|
-
.wc-shader .wc-fx
|
|
1140
|
+
.wc-shader .wc-fx,
|
|
1141
|
+
.wc-asciinoise .wc-fx {
|
|
1116
1142
|
transition: none;
|
|
1117
1143
|
}
|
|
1118
1144
|
}
|
package/src/wall.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export type Kind =
|
|
|
46
46
|
| 'paper'
|
|
47
47
|
| 'gradient'
|
|
48
48
|
| 'shader'
|
|
49
|
+
| 'asciinoise'
|
|
49
50
|
| LookKind;
|
|
50
51
|
/** A card's made-up brand: its name, its line ("Coffee Co."), a tagline and a web address ending, from one sector. */
|
|
51
52
|
export type Brand = {
|
|
@@ -85,6 +86,16 @@ export type LookbookOptions = {
|
|
|
85
86
|
faces: readonly Face[];
|
|
86
87
|
/** The accent (acid lime, `ACCENT`, by default). */
|
|
87
88
|
accent?: string;
|
|
89
|
+
/**
|
|
90
|
+
* More grounds and inks for the colour cards, `[ground, ink]`, dealt after the built-in twelve (the accent first). Default
|
|
91
|
+
* none, so a wall without them deals the same cards as before.
|
|
92
|
+
*/
|
|
93
|
+
palettes?: readonly (readonly [string, string])[];
|
|
94
|
+
/**
|
|
95
|
+
* How often looks are dealt, over `WEIGHTS` (relative; 0 deals a look never). `asciinoise` is 0 unless given one, so a
|
|
96
|
+
* wall without it deals the same cards as before; `{ asciinoise: 1 }` deals it as often as the paper card.
|
|
97
|
+
*/
|
|
98
|
+
weights?: Partial<Record<Kind, number>>;
|
|
88
99
|
/** Where a card links: `#slug` by default. */
|
|
89
100
|
href?: (mark: WallMark) => string;
|
|
90
101
|
/** Pictures in `assets.photos` that are never a card's ground (a site's other photos kept in the same folder). */
|
|
@@ -118,12 +129,16 @@ export type Lookbook = {
|
|
|
118
129
|
/** How often each look is dealt (relative). The older looks keep the shares they had as a list (photo and gradient 3 in
|
|
119
130
|
* 23, tone, shader, mono and duo 2 …); the drawn looks' weights are `LOOK_WEIGHTS`, about 8 in 31 together. */
|
|
120
131
|
export declare const WEIGHTS: Record<Kind, number>;
|
|
132
|
+
/** Names for the looks here whose id doesn't read as one (the others are their id, capitalised; the drawn looks' are
|
|
133
|
+
* `LOOK_LABEL`). */
|
|
134
|
+
export declare const KIND_LABEL: Partial<Record<Kind, string>>;
|
|
121
135
|
/** A promo card every this many marks (`feed`). */
|
|
122
136
|
export declare const EVERY = 30;
|
|
123
137
|
/**
|
|
124
138
|
* A wall: `card`, `feed` and `backgrounds`, with the brand picker, the typefaces and the accent given here.
|
|
125
139
|
*
|
|
126
|
-
* @param options The brand picker, the faces, and optionally the accent, the
|
|
140
|
+
* @param options The brand picker, the faces, and optionally the accent, more palettes, the looks' weights, the links and
|
|
141
|
+
* the photos to skip.
|
|
127
142
|
*/
|
|
128
143
|
export declare function lookbook(options: LookbookOptions): Lookbook;
|
|
129
144
|
/**
|
package/src/wall.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { liveGradient } from '@arraypress/effects-astro/runtime/live-gradient';
|
|
11
|
+
import { asciiCells, rampOf } from '@arraypress/effects-astro/runtime/ascii-noise';
|
|
12
|
+
import { mixOklab, parseColor, toHex } from '@arraypress/effects-astro/runtime/color';
|
|
11
13
|
import { escapeHtml } from '@arraypress/text';
|
|
12
14
|
// the share cards' mesh palettes and seeded random (@arraypress/og-image draws with the same); browser-safe
|
|
13
15
|
import { PALETTES as OG_MESHES, hash, rng } from '@arraypress/og-image/palette';
|
|
@@ -98,6 +100,7 @@ const RATIO = {
|
|
|
98
100
|
paper: '4 / 5',
|
|
99
101
|
gradient: '4 / 5',
|
|
100
102
|
shader: '4 / 5',
|
|
103
|
+
asciinoise: '4 / 5',
|
|
101
104
|
...LOOK_RATIO,
|
|
102
105
|
};
|
|
103
106
|
/** How often each look is dealt (relative). The older looks keep the shares they had as a list (photo and gradient 3 in
|
|
@@ -118,10 +121,14 @@ export const WEIGHTS = {
|
|
|
118
121
|
crt: 1,
|
|
119
122
|
pattern: 1,
|
|
120
123
|
crop: 1,
|
|
124
|
+
// dealt only where a wall gives it a weight (`lookbook({ weights })`), so the walls made before it came deal as they did
|
|
125
|
+
asciinoise: 0,
|
|
121
126
|
...LOOK_WEIGHTS,
|
|
122
127
|
};
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
|
|
129
|
+
/** Names for the looks here whose id doesn't read as one (the others are their id, capitalised; the drawn looks'
|
|
130
|
+
* are `LOOK_LABEL`). */
|
|
131
|
+
export const KIND_LABEL = { asciinoise: 'ASCII noise' };
|
|
125
132
|
|
|
126
133
|
/** The live backgrounds a shader card can have: Paper's shaders (vendored in the effects library), the calm looks
|
|
127
134
|
* picked from its presets (2026-11-12: the rainbow colour panels, the white-hot smoke ring, the grey ink and Paper's
|
|
@@ -170,6 +177,48 @@ const LOOKS = [
|
|
|
170
177
|
},
|
|
171
178
|
];
|
|
172
179
|
|
|
180
|
+
/** ASCII noise cards' colours: ground, the quiet cells, the loud cells, and the lockup. */
|
|
181
|
+
const noiseInksOf = (accent) => [
|
|
182
|
+
['#0B0B0B', '#3A3A3A', '#FFFFFF', '#FFFFFF'], // graphite
|
|
183
|
+
['#0B0B0B', '#2C3A0A', accent, accent], // acid
|
|
184
|
+
['#0B0B0B', '#0D3B2A', '#39FF88', '#39FF88'], // phosphor
|
|
185
|
+
['#0038FF', '#2F5CFF', '#FFFFFF', '#FFFFFF'], // cobalt
|
|
186
|
+
['#F4F3EF', '#D2D0C8', '#0B0B0B', '#0B0B0B'], // paper
|
|
187
|
+
['#FF3D00', '#FF7A4D', '#0B0B0B', '#0B0B0B'], // signal
|
|
188
|
+
];
|
|
189
|
+
/** The ramps an ASCII noise card takes (effects-astro's NOISE_RAMPS, each quietest first, all in a monospaced face; the
|
|
190
|
+
* shade blocks after a space, so the quiet middle is empty, not a texture). */
|
|
191
|
+
const NOISE_RAMPS = ['ascii', ' ░▒▓█', 'digits', 'rise', 'dense', 'quads'];
|
|
192
|
+
/** The glyphs' face when the wall has no monospaced one. */
|
|
193
|
+
const NOISE_FONT = 'ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
194
|
+
/** A noise card's cell, width over height (a monospaced face's advance). */
|
|
195
|
+
const NOISE_ASPECT = 0.6;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* An ASCII noise card's first frame as SVG text: the characters its shader starts on (effects-astro's `asciiCells`), a
|
|
199
|
+
* row a line pinned to the cell pitch (`textLength`). In one tone, between the quiet and loud colours (a colour a run
|
|
200
|
+
* made each card ~19 KB; this is ~3 KB): the shader's canvas fades in over it and the tones settle in.
|
|
201
|
+
*
|
|
202
|
+
* @param cfg The card's noise settings.
|
|
203
|
+
* @param font The glyphs' face.
|
|
204
|
+
*/
|
|
205
|
+
function noiseStill(cfg, font) {
|
|
206
|
+
const ramp = rampOf(cfg.glyphs),
|
|
207
|
+
cols = cfg.cols,
|
|
208
|
+
h = 1 / NOISE_ASPECT;
|
|
209
|
+
// a 4:5 card: cols × 1.25 widths tall, in rows of 1 / aspect
|
|
210
|
+
const rows = Math.round((cols * 1.25) / h);
|
|
211
|
+
const [lo, hi] = cfg.colors.map(parseColor);
|
|
212
|
+
const tone = toHex(mixOklab(lo, hi, 0.7));
|
|
213
|
+
const text = asciiCells(cfg, cols, rows).map(
|
|
214
|
+
(row, j) =>
|
|
215
|
+
// spaces as no-break spaces: SVG text collapses runs of spaces (whatever `white-space` says), and `textLength`
|
|
216
|
+
// would spread what's left across the row
|
|
217
|
+
`<text y="${((j + 0.5) * h).toFixed(2)}" textLength="${cols}" lengthAdjust="spacing">${escapeHtml(row.map((i) => ramp[i]).join('')).replaceAll(' ', '\u00a0')}</text>`,
|
|
218
|
+
);
|
|
219
|
+
return `<svg class="wc-noise" viewBox="0 0 ${cols} ${(rows * h).toFixed(2)}" xml:space="preserve" font-size="${(h * 0.92).toFixed(3)}" fill="${tone}" style="font-family:${escapeHtml(font)}" aria-hidden="true">${text.join('')}</svg>`;
|
|
220
|
+
}
|
|
221
|
+
|
|
173
222
|
const NONE = { kinds: [], names: [], lines: [], photos: [] };
|
|
174
223
|
/** How far back each repeat is avoided, in cards. */
|
|
175
224
|
const SPAN = { kinds: 3, names: 30, lines: 8, photos: 12 };
|
|
@@ -179,7 +228,8 @@ export const EVERY = 30;
|
|
|
179
228
|
/**
|
|
180
229
|
* A wall: `card`, `feed` and `backgrounds`, with the brand picker, the typefaces and the accent given here.
|
|
181
230
|
*
|
|
182
|
-
* @param options The brand picker, the faces, and optionally the accent, the links and the
|
|
231
|
+
* @param options The brand picker, the faces, and optionally the accent, more colour-card palettes, the links and the
|
|
232
|
+
* photos to skip.
|
|
183
233
|
*/
|
|
184
234
|
export function lookbook(options) {
|
|
185
235
|
const { brand: pickBrand, faces: FACES } = options;
|
|
@@ -187,9 +237,15 @@ export function lookbook(options) {
|
|
|
187
237
|
const href = options.href ?? ((m) => `#${m.slug}`);
|
|
188
238
|
const skip = options.skip;
|
|
189
239
|
const skipped = (p) => !!skip && skip.test(p);
|
|
190
|
-
const PALETTES = palettesOf(accent),
|
|
240
|
+
const PALETTES = [...palettesOf(accent), ...(options.palettes ?? [])],
|
|
191
241
|
INKS = inksOf(accent),
|
|
192
|
-
TONES = tonesOf(accent)
|
|
242
|
+
TONES = tonesOf(accent),
|
|
243
|
+
NOISE = noiseInksOf(accent);
|
|
244
|
+
// the looks this wall deals, by weight: `WEIGHTS`, and `options.weights` over them (a look at 0 isn't dealt)
|
|
245
|
+
const DEAL = Object.entries({ ...WEIGHTS, ...options.weights }).filter(([, w]) => w > 0);
|
|
246
|
+
const TOTAL = DEAL.reduce((s, [, w]) => s + w, 0);
|
|
247
|
+
/** The face an ASCII noise card's name takes: the first monospaced one given, else the card's own. */
|
|
248
|
+
const MONO = FACES.find(([family]) => /mono/i.test(family));
|
|
193
249
|
|
|
194
250
|
/** One card's HTML, its height over its width, its brand, and what it used. `deal` changes with Shuffle (new names
|
|
195
251
|
* and looks for the same marks); `recent` is what the cards just before it used, so neighbours don't repeat a look, a
|
|
@@ -366,6 +422,29 @@ export function lookbook(options) {
|
|
|
366
422
|
attrs = ` data-shader="${escapeHtml(JSON.stringify(cfg))}"`;
|
|
367
423
|
style += `;--fg:${look.ink ?? '#fff'};background:${typeof look.still === 'string' ? look.still : look.still(a, b, c, base)}`;
|
|
368
424
|
inner = `<canvas class="wc-fx" aria-hidden="true"></canvas>${r() < 0.5 ? `<span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${type}">${escapeHtml(name)}</b><i>${escapeHtml(line)}</i></span>` : `<span class="wc-lockup">${svg()}<b class="wc-name" style="${type}">${escapeHtml(name)}</b></span>`}`;
|
|
425
|
+
} else if (kind === 'asciinoise') {
|
|
426
|
+
// a field of drifting type (effects-astro's asciiNoise, started on screen like a shader) in a monospaced
|
|
427
|
+
// face, the middle kept quiet for the lockup; its first frame is laid as text, so the card shows the field
|
|
428
|
+
// before the shader starts, without WebGL and in Plain's neighbours
|
|
429
|
+
const [bg, lo, hi, fg] = pick(NOISE);
|
|
430
|
+
const font = MONO?.[0] ?? NOISE_FONT;
|
|
431
|
+
const cfg = {
|
|
432
|
+
effect: 'ascii-noise',
|
|
433
|
+
glyphs: pick(NOISE_RAMPS),
|
|
434
|
+
cols: pick([40, 48]),
|
|
435
|
+
scale: pick([1.8, 2.45, 3.1]),
|
|
436
|
+
contrast: pick([4, 6]),
|
|
437
|
+
brightness: pick([-0.15, -0.1, -0.05]),
|
|
438
|
+
offset: [Math.round(r() * 4000) / 100, Math.round(r() * 4000) / 100],
|
|
439
|
+
colors: [lo, hi],
|
|
440
|
+
background: bg,
|
|
441
|
+
font,
|
|
442
|
+
quiet: { radius: 0.56, depth: 1 },
|
|
443
|
+
};
|
|
444
|
+
attrs = ` data-shader="${escapeHtml(JSON.stringify(cfg))}"`;
|
|
445
|
+
style += `;--bg:${bg};--fg:${fg}`;
|
|
446
|
+
const mono = MONO ? `font-family:${MONO[0]};font-weight:${MONO[1]};letter-spacing:${MONO[2]};text-transform:${MONO[3]}` : type;
|
|
447
|
+
inner = `${noiseStill(cfg, font)}<canvas class="wc-fx" aria-hidden="true"></canvas><span class="wc-lockup is-stack">${svg()}<b class="wc-name" style="${mono}">${escapeHtml(name)}</b><i style="font-family:${font}">${escapeHtml(line)}</i></span>`;
|
|
369
448
|
} else if (kind === 'tone') {
|
|
370
449
|
const [bg, tint] = pick(TONES);
|
|
371
450
|
style += `;--bg:${bg};--accent:${tint}`;
|