@ewanc26/noise-avatar 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +3 -53
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,63 +1,13 @@
1
1
  # @ewanc26/noise-avatar
2
2
 
3
- Deterministic value-noise avatar generation from a string seed. Thin opinionated wrapper around [`@ewanc26/noise`](../noise). Zero extra runtime dependencies, works in any environment with a Canvas API (browsers, jsdom).
4
-
5
- Part of the [`@ewanc26/pkgs`](https://github.com/ewanc26/pkgs) monorepo.
6
-
7
- ## Install
3
+ Deterministic value-noise avatar generation from a string seed. Thin wrapper around [`@ewanc26/noise`](../noise).
8
4
 
9
5
  ```bash
10
6
  pnpm add @ewanc26/noise-avatar
11
7
  ```
12
8
 
13
- ## Usage
14
-
15
- ### Vanilla
16
-
17
- ```ts
18
- import { renderNoiseAvatar } from '@ewanc26/noise-avatar';
19
-
20
- const canvas = document.querySelector('canvas');
21
- renderNoiseAvatar(canvas, 'Alice|Subscription');
22
- ```
23
-
24
- ### Svelte action
25
-
26
- ```svelte
27
- <script>
28
- import { noiseAvatarAction } from '@ewanc26/noise-avatar';
29
- let seed = 'Alice|Subscription';
30
- </script>
31
-
32
- <canvas use:noiseAvatarAction={seed} class="rounded-full"></canvas>
33
- ```
34
-
35
- ## API
36
-
37
- ### `renderNoiseAvatar(canvas, seed, options?)`
38
-
39
- Renders a deterministic HSL value-noise texture onto `canvas` at `displaySize × displaySize` pixels.
40
-
41
- | Option | Type | Default | Description |
42
- |---|---|---|---|
43
- | `gridSize` | `number` | `5` | Noise grid resolution |
44
- | `displaySize` | `number` | `64` | Canvas pixel size |
45
- | `hueRange` | `number` | `60` | Hue spread in degrees around seed-derived base hue |
46
- | `saturationRange` | `[number, number]` | `[45, 70]` | Saturation min/max (%) |
47
- | `lightnessRange` | `[number, number]` | `[40, 70]` | Lightness min/max (%) |
48
-
49
- ### `noiseAvatarAction(canvas, seed, options?)`
50
-
51
- Svelte action wrapper. Re-renders when `seed` changes via `update`.
52
-
53
- ### Re-exported primitives
54
-
55
- `hash32`, `makePrng`, `hslToRgb`, `makeValueNoiseSampler`, and `generateNoisePixels`
56
- are all re-exported from `@ewanc26/noise` for convenience.
57
-
58
- For full control over dimensions, FBM octaves, and colour modes, use
59
- [`@ewanc26/noise`](../noise) directly.
9
+ Full documentation at **[docs.ewancroft.uk](https://docs.ewancroft.uk/projects/noise-avatar)**.
60
10
 
61
11
  ## Licence
62
12
 
63
- AGPL-3.0-only
13
+ AGPL-3.0-only.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ewanc26/noise-avatar",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Deterministic value-noise avatar generation from a string seed. Thin wrapper around @ewanc26/noise. Zero extra dependencies, works in any environment with a Canvas API.",
5
5
  "author": "Ewan Croft",
6
6
  "license": "AGPL-3.0-only",