git-hash-art 0.6.0 → 0.8.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/ALGORITHM.md CHANGED
@@ -11,12 +11,13 @@ Hash String
11
11
 
12
12
  ├─► Archetype Selection (1 of 10 visual personalities)
13
13
 
14
- ├─► Color Scheme (palette mode from archetype + temperature mode)
14
+ ├─► Color Scheme (palette mode from archetype + temperature mode + contrast enforcement)
15
15
 
16
16
  └─► Rendering Pipeline (parameters overridden by archetype)
17
17
 
18
18
  0. Archetype Override (gridSize, layers, opacity, sizes, styles)
19
19
  1. Background Layer (7 styles: radial, linear, solid, multi-stop)
20
+ 1a. Background Luminance → contrast enforcement threshold
20
21
  1b. Layered Background (faint shapes + concentric rings)
21
22
  2. Composition Mode Selection
22
23
  2b. Symmetry Mode Selection (none / bilateral / quad)
@@ -27,7 +28,8 @@ Hash String
27
28
  │ ├─ Blend Mode (per-layer compositing)
28
29
  │ ├─ Render Style (archetype-preferred + random mix)
29
30
  │ ├─ Position (composition mode + focal bias + density check)
30
- │ ├─ Shape Selection (layer-weighted)
31
+ │ ├─ Shape Selection (4 categories: basic, complex, sacred, procedural)
32
+ │ ├─ Contrast Enforcement (ensure readability vs background)
31
33
  │ ├─ Atmospheric Depth (desaturation on later layers)
32
34
  │ ├─ Temperature Contrast (foreground opposite to background)
33
35
  │ ├─ Styling (transparency, glow, gradients, color jitter)
@@ -267,13 +269,25 @@ Later layers progressively desaturate their colors (0% on layer 0, up to 30% on
267
269
 
268
270
  ### Shape Selection (Layer-Weighted)
269
271
 
270
- Shapes are divided into three categories with weights that shift across layers:
272
+ Shapes are divided into four categories with weights that shift across layers:
271
273
 
272
274
  | Category | Shapes | Early layers | Late layers |
273
275
  |----------|--------|-------------|-------------|
274
276
  | **Basic** | circle, square, triangle, hexagon, diamond, cube | High weight | Low weight |
275
277
  | **Complex** | star, platonic solid, fibonacci spiral, islamic pattern, celtic knot, merkaba, fractal | Medium | Medium-high |
276
278
  | **Sacred** | mandala, flower of life, tree of life, Metatron's cube, Sri Yantra, seed of life, vesica piscis, torus, egg of life | Low | High |
279
+ | **Procedural** | blob, ngon, lissajous, superellipse, spirograph, waveRing, rose | Medium (always present) | Medium-high |
280
+
281
+ Procedural shapes are hash-derived — their geometry is generated from the RNG, so every hash produces unique shapes that don't exist in any other generation. See the Procedural Shapes section below for details.
282
+
283
+ ### Contrast Enforcement
284
+
285
+ After color selection, every foreground color (fills, strokes, flow lines, connecting curves) is checked against the average background luminance. If the luminance difference is below the minimum threshold (0.15), the color is adjusted:
286
+
287
+ - **Light backgrounds** — foreground colors are darkened and saturated
288
+ - **Dark backgrounds** — foreground colors are lightened and saturated
289
+
290
+ This prevents the white-on-white and dark-on-dark readability problems that occur when light palette modes (pastel-light, high-contrast) combine with light background styles (solid-light, radial-light).
277
291
 
278
292
  ### Size Distribution
279
293
 
@@ -366,6 +380,19 @@ Mathematically precise sacred geometry patterns:
366
380
  - **Torus** — 2D projection of a torus via line segments
367
381
  - **Egg of Life** — 7 circles in tight hexagonal packing
368
382
 
383
+ ### Procedural Shapes
384
+ Hash-derived shapes whose geometry is generated from the RNG. Every hash produces unique shapes that don't exist in any other generation:
385
+
386
+ | Shape | Algorithm | Hash Controls |
387
+ |-------|-----------|---------------|
388
+ | **Blob** | Smooth closed curve via quadratic bezier through 5-9 control points arranged around a circle | Number of lobes (5-9), radius jitter per lobe (50-100%) |
389
+ | **Ngon** | Irregular polygon with independent vertex displacement | Side count (3-12), vertex jitter amount (10-50%) |
390
+ | **Lissajous** | Parametric curve `x = sin(a*t + φ), y = sin(b*t)` | Frequency ratios a,b (1-5 each), phase offset φ |
391
+ | **Superellipse** | `|x|^n + |y|^n = 1` rendered parametrically | Exponent n: 0.3 (spiky astroid) → 2 (circle) → 5 (rounded rectangle) |
392
+ | **Spirograph** | Hypotrochoid curve `(R-r)cos(t) + d*cos((R-r)t/r)` | Inner radius ratio r (0.2-0.8), pen distance d (0.3-1.0) |
393
+ | **Wave Ring** | Concentric rings with sinusoidal radial displacement | Ring count (2-5), wave frequency (3-14), amplitude (5-20%) |
394
+ | **Rose** | Polar rose curve `r = cos(k*θ)` | Petal parameter k (2-7), producing k or 2k petals |
395
+
369
396
  ## Configuration
370
397
 
371
398
  All parameters are exposed via `GenerationConfig`:
package/CHANGELOG.md CHANGED
@@ -4,8 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [0.8.0](https://github.com/gfargo/git-hash-art/compare/0.7.0...0.8.0)
8
+
9
+ - feat: major visual quality improvements [`#14`](https://github.com/gfargo/git-hash-art/pull/14)
10
+ - fix: convert generateExamples.js to CJS require() syntax [`0662e61`](https://github.com/gfargo/git-hash-art/commit/0662e61ef82ef879b1e31929e640a797ca3278bd)
11
+
12
+ #### [0.7.0](https://github.com/gfargo/git-hash-art/compare/0.6.0...0.7.0)
13
+
14
+ > 19 March 2026
15
+
16
+ - feat: procedural shape generators and contrast enforcement [`#13`](https://github.com/gfargo/git-hash-art/pull/13)
17
+ - feat: procedural shapes and contrast enforcement [`4f018ab`](https://github.com/gfargo/git-hash-art/commit/4f018abb4c89849954ccc941ee7e9ab468231f78)
18
+ - docs: update ALGORITHM.md with procedural shapes and contrast enforcement [`3e044fd`](https://github.com/gfargo/git-hash-art/commit/3e044fd940fbc0f62e3a9696fa815145cf315f67)
19
+ - chore: release v0.7.0 [`1c0ad5e`](https://github.com/gfargo/git-hash-art/commit/1c0ad5e112c2c5547e4f83c7808e09ebb0db5e40)
20
+
7
21
  #### [0.6.0](https://github.com/gfargo/git-hash-art/compare/0.5.0...0.6.0)
8
22
 
23
+ > 19 March 2026
24
+
9
25
  - feat: archetype system, palette modes, background variety, and CLI [`#12`](https://github.com/gfargo/git-hash-art/pull/12)
10
26
  - feat: archetype system for dramatically different visual personalities [`2a1b919`](https://github.com/gfargo/git-hash-art/commit/2a1b919c51d3bfbd9d5c7a381ea5e104f81df2f6)
11
27
  - feat: add CLI for generating art from terminal [`184372a`](https://github.com/gfargo/git-hash-art/commit/184372a584f68031bf44379f385f2e78691f98aa)
@@ -1,7 +1,8 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { generateImageFromHash, saveImageToFile } from '../dist/main.js';
4
- import { PRESETS } from '../src/lib/constants.js';
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { generateImageFromHash, saveImageToFile } = require('../dist/main.js');
5
+ const { PRESETS } = require('../dist/main.js');
5
6
 
6
7
  const OUTPUT_DIR = './examples';
7
8
 
@@ -21,7 +22,7 @@ function generateTestCases() {
21
22
  const imageBuffer = generateImageFromHash(testCase.hash, {
22
23
  width: testCase.width,
23
24
  height: testCase.height,
24
- ...testCase, // Include any additional configuration from the preset
25
+ ...testCase,
25
26
  });
26
27
  const outputPath = saveImageToFile(imageBuffer, OUTPUT_DIR, testCase.hash, label, testCase.width, testCase.height);
27
28
  results.push({ label, hash: testCase.hash, outputPath, success: true });
@@ -47,13 +48,4 @@ function generateTestCases() {
47
48
  });
48
49
  }
49
50
 
50
- // Run the test cases
51
51
  generateTestCases();
52
-
53
-
54
-
55
- // const gitHash = '1234567890abcdef1234567890abcdef12345678';
56
- // const imageBuffer = generateImageFromHash(gitHash, { width: 1024, height: 1024 });
57
- // const savedImagePath = saveImageToFile(imageBuffer, './output', gitHash, 'example', 1024, 1024);
58
- // console.log(`Image saved to: ${savedImagePath}`);
59
-