Repository navigation
Table.CellFill (heatmap cells) + Viridis colormap + ContrastInk - #483
Merged
Merged
Conversation
CellFill(row, col) gives a body cell its own background and re-inks its text black or white by WCAG contrast. The selected row keeps its accent band. nil (the zero value) renders byte-for-byte as before. Viridis(t) is the shared sequential colour scale for any heatmap, so apps do not each invent a ramp; ContrastInk picks the readable ink on a fill. First consumer: the go-ndarray playground shows 2-D arrays as a heatmap table. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A two-way binding that Sets Text() to a shorter value left the caret past the end; Draw clamped it, but a Backspace arriving before the next Draw sliced past the end and panicked. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Table.CellFill func(row, col int) (RGBA, bool)— a per-cell background, which turns aTableinto a heatmap of the numbers it shows. A filled cell's text is re-inked black or white, whichever has the higher WCAG contrast with the fill. The selected row keeps its accent band (the fill yields to it).nil— the zero value — renders byte-for-byte as before.Viridis(t float64) RGBA— matplotlib's perceptually uniform sequential colormap (nine reference samples, linear interpolation, clamped, NaN → 0). A shared colour scale so every heatmap in the fleet scales values the same way.ContrastInk(bg RGBA) RGBA— black or white, whichever reads onbg.fix(entry): clamp the caret before editing after an external
Text().Set. A two-way binding that pushes a shorter value left the caret past the end;Drawclamped it, but a Backspace arriving before the nextDrawsliced past the end and panicked (slice bounds out of range [8:1]).TestEntryCaretClampedAfterExternalSetpanics without the clamp (negative control run).Why
The go-ndarray WASM playground (go-ndarray/go-ndarray.github.io,
playground/) shows each intermediate 2-D array as a table whose cells are coloured by value. The toolkit had no heatmap and no way to colour a cell, and the house rule is to add the capability here rather than draw it in the app.Shareable: the go-fft playground (built in parallel) can use
Viridisfor a spectrogram/magnitude view andTable.CellFillfor a coloured value table.Tests
table_cellfill_test.go: fill painted in a filled cell, row background kept in a declined one, white ink on a dark fill; selection band wins over the fill (negative control: removing the guard makes this test fail); a CellFill that declines everything is byte-identical to none; frozen/scrolled path fills both regions; Viridis endpoints/clamps/NaN/midpoints and monotone luminance; ContrastInk on both ends and the linear sRGB segment.CellFillis a func hook, so the MVVM gate allows it without an allowlist entry. Root package stays at 100.0% statement coverage locally; gofmt and vet clean.🤖 Generated with Claude Code