Skip to content

Commit 8a66963

Browse files
alexnodelandclaude
andauthored
Unify playground heatmap with the tutorial widgets' data ramp (#15)
The playground painted its landscape heatmap with an ink ramp (ridges shaded, basins clear) while every tutorial widget glows basins in the data role. Same log normalization, same (1-t)*0.55 alpha, data color. Claude-Session: https://claude.ai/code/session_018yo1jdkckG7yQ9eBqLbaDB Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent c673814 commit 8a66963

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docs/viz/playground.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,21 @@
180180
heatCv.height = GRID_N;
181181
var hctx = heatCv.getContext("2d");
182182
var img = hctx.createImageData(GRID_N, GRID_N);
183-
var rgb = toRgb(th.colors.ink);
183+
var rgb = toRgb(th.colors.data);
184184
var span = g.max - g.min || 1;
185185
var lspan = Math.log(1 + span);
186186
for (var j = 0; j < GRID_N; j++) { // grid j indexes y from ymin up
187187
var row = GRID_N - 1 - j; // canvas y grows downward
188188
for (var i = 0; i < GRID_N; i++) {
189189
// Log ramp so deep, narrow basins still read (Rosenbrock's corner
190-
// values dwarf the valley on a linear ramp). Basins stay nearly
191-
// clear; ridges shade with ink — chrome only, no color role burned.
190+
// values dwarf the valley on a linear ramp). Basins glow in the
191+
// data role — the same ramp the tutorial widgets use.
192192
var t = Math.log(1 + (g.vals[j * GRID_N + i] - g.min)) / lspan;
193193
var off = (row * GRID_N + i) * 4;
194194
img.data[off] = rgb[0];
195195
img.data[off + 1] = rgb[1];
196196
img.data[off + 2] = rgb[2];
197-
img.data[off + 3] = Math.round(255 * (0.05 + 0.5 * t));
197+
img.data[off + 3] = Math.round(255 * 0.55 * (1 - t));
198198
}
199199
}
200200
hctx.putImageData(img, 0, 0);

0 commit comments

Comments
 (0)