Skip to content

[Bug]: Layout commands drop a colour the element kind doesn't have, without a word #1455

Closed

Description

@jgregoriorincon

Before you start

  • 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

  1. rustgis-cli run --sample --cmd 'layout.new={}' --cmd 'layout.update={"element":<the legend'"'"'s id>,"color":"#B91C1C"}'
  2. The command succeeds; the legend is unchanged and nothing says the colour was not used.
  3. 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".

How are you running RustGIS?

Command line (rustgis-cli)

Version

main at d733327

Operating system, browser and graphics

macOS 15 (Darwin 24.6)

Sample data

The World Atlas sample (--sample).

Screenshots or logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions