You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Layout commands drop a colour the element kind doesn't have, without a word #1455
I searched the existing issues and did not find a duplicate.
This is a bug report, not a usage question (questions belong in Discussions).
What happened?
layout.update and layout.addElement accept "color", "fill" and "outline" for every element kind, but each kind uses only some of them. A valid colour given to a kind that has no such colour is dropped without a word: the command succeeds and nothing changes.
"color" is used by texts, lines and arrows, rectangles, ellipses and circles, scale bars ([Feature]: Scale bar colours: an ink colour and a fill for the alternating bar's light blocks #1451), and, when adding, extent indicators and grids. On a picture, table, chart, legend, colorbar, map frame or north arrow (which has fill and outline), it is ignored. In layout.update it is read once (col, crates/engine/src/cmd/layout.rs) and applied only in the ElementKind::Text arm.
"fill" and "outline" are dropped the same way on the kinds that have neither.
Found in the review of #1452 (#1452 (comment)). font/fallback and radius are already refused on the kinds that don't take them (gives_font, ONLY_RECTANGLE_RADIUS); the colours have no such check.
Steps to reproduce
rustgis-cli run --sample --cmd 'layout.new={}' --cmd 'layout.update={"element":<the legend'"'"'s id>,"color":"#B91C1C"}'
The command succeeds; the legend is unchanged and nothing says the colour was not used.
The same with layout.addElement={"kind":"picture","path":"…","color":"#B91C1C"}, or "fill" on a table.
Expected behavior
A colour key given to an element kind that doesn't have that colour is refused, before anything changes, with a message naming the kinds that take it (as font and radius are), in both layout.addElement and layout.update. null still means "not given".
Activity
fix(layout): refuse a colour the element kind doesn't have (#1455) (#…