Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- feat: `labs()` fields default to `auto`; pass `none` to suppress an axis or legend title and reclaim the space it reserved. (#12)
- feat: `element-blank()` on a text surface (axis, plot, or legend title) collapses the space the text would reserve. (#12)
- feat: `width`/`height` accept `auto` to fill the available space of a bounded container. (#10)
- fix: `scale-*-manual()` with an empty `values` array reports a clear error instead of an opaque divide-by-zero. (#36)
- fix: number formatters carry a fraction that rounds up to a whole unit (e.g., `0.9999995` no longer renders as `0.1`), and `format-scientific` keeps its mantissa in `[1, 10)`. (#35)
- fix: legend guides reserve space for multi-line labels, measuring the resolved custom `labels:` for both width and line count across swatch, size-ladder, and colourbar guides, so two-line content no longer clips or overlaps. (#33)
- fix: a column mapped to both a positional aesthetic (`x`/`y`) and a grouping aesthetic (`fill`/`colour`/`group`/...), e.g., `aes(x: "class", fill: "class")`, now resolves the grouping aesthetic across aggregating stats (`boxplot`, `summary`, `count`/`sum`, histograms) instead of drawing every mark in the ink colour with an empty guide. (#31)
Expand Down
9 changes: 8 additions & 1 deletion src/utils/palette.typ
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,14 @@
)

// Index a palette with modulo wrap so out-of-range indices cycle.
#let palette-at(palette, idx) = palette.at(calc.rem(idx, palette.len()))
#let palette-at(palette, idx) = {
if palette.len() == 0 {
panic(
"palette-at: palette is empty; scale-*-manual() needs at least one value",
)
}
palette.at(calc.rem(idx, palette.len()))
}

// Resolve the palette declared on a trained scale. When the scale carries no
// explicit palette, continuous scales receive `default-continuous`; everything
Expand Down
Loading