Skip to content

fix(layout): an Edge sheet's kicker reads on its paper - #3303

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3301-edge-accent-dark-paper
Nov 29, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3301-edge-accent-dark-paper

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On an Edge publication sheet the kicker was drawn in the accent whatever the paper, so on a dark paper the default brick red #B4432E came out at 2.8:1 against #1B2430.

The kicker now takes the accent as given where it reaches 4.5:1 against the paper, and otherwise the accent mixed toward that paper's text colour, in twentieths, until it does (#C77665 for the default accent on #1B2430). A paper on which no mix reaches it, such as a mid grey, gives the text colour, as the title has. It is decided when layout.publication makes the sheet; changing the page colour afterwards leaves the texts as made, as before.

The title, subtitle, headline figures and footer already used the paper's text colour, and other styles are unchanged.

The change is inside layout.publication, so it reaches every surface that runs the command (desktop and web wizard, command line, scripts, Assistant) with no new parameter, command or UI string. The wizard's style thumbnail draws a bar in the accent, not text, and is unchanged.

Testing

  • New tests in crates/engine/src/tests/layout_edge.rs: the default accent on a dark paper, an accent that doesn't read on a dark and on a light paper, one that reads, and a mid grey paper. Three of them failed before the change.
  • cargo nextest run -p rustgis-engine -E 'test(/layout_edge/) | test(/publication/)': 116 passed.
  • cargo fmt --all --check, cargo clippy -p rustgis-engine, cargo nextest run (10701 passed, 29 skipped, the two DuckDB tests left out locally), doctests, layer check and cargo xtask schema --check: all passed.
  • ui_shot: the sheet exported before and after (crop below).

UI evidence

An Edge sheet on "paper": "#1B2430" with the default accent, before (top) and after (bottom):

An Edge sheet kicker before and after

Related issue

Closes #3301.

Summary by CodeRabbit

  • Bug Fixes
    • Edge-sheet kicker text now adjusts its color when the accent lacks sufficient contrast with the sheet, improving readability while preserving accents that already meet the contrast threshold.
    • When a suitable accent adjustment isn’t available, the text uses the existing ink color.
  • Documentation
    • Updated the publication layout guide to describe how edge-sheet kicker colors are adjusted when the sheet is created.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Edge publication sheets now adjust kicker text toward the existing ink color when its accent does not meet 4.5:1 contrast against the paper. The selection uses WCAG contrast calculations. Layout tests and the user guide cover this behavior.

Changes: Edge kicker contrast

Layer / File(s) Summary
Contrast-aware kicker rendering
crates/engine/src/cmd/layout/publication/sheet.rs, crates/engine/src/cmd/layout/publication/mod.rs, crates/engine/src/tests/layout_edge.rs, docs/user-guide/layouts.md
accent_ink checks accent-to-ink mixes in 5% increments and selects the first that reaches 4.5:1 contrast against the paper, or returns the ink if none qualifies. The Edge kicker uses this result. Tests cover dark and light papers, readable accents, and cases where the threshold cannot be reached. The guide describes the adjustment.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • opengeos/RustGIS issue 3290 describes choosing text ink based on the paper when creating a publication layout. This change also uses the paper color to determine the Edge kicker color.
  • opengeos/RustGIS issue 3104 requests an Edge style with paper-dependent text colors and an accent-colored kicker. This change retains the accent when readable and adjusts it when needed.

Suggested reviewers: elpidioassinaturas, mavrick-f

Merge Risk: Minimal · up to e0e97

Edge publication sheet kickers now stay readable on dark or light paper by shifting the accent toward the text color when contrast is below 4.5:1. The change is narrow, covered by tests, and easy to revert, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(layout): an Edge sheet's kicker reads on its paper" names the main change: the Edge sheet kicker now picks a text colour that stays readable on the paper. The changeset adds accent_ink,…
Description check Passed The description follows the template. It has a Summary that explains the problem, the fix, and the scope. It has a Testing section that lists new tests, commands run, and results. It has a UI evidence…
Linked Issues check Passed Issue #3301 asks that the Edge sheet kicker reach 4.5:1 against a dark paper, keep the accent's hue where possible, and leave an accent that already reads unchanged. At head, accent_ink in `crates/e…
Out of Scope Changes check Passed The changes match the issue. sheet.rs adds accent_ink and the contrast helper. publication/mod.rs applies accent_ink to the Edge kicker only. The tests in layout_edge.rs cover this functio…
Full details: Title check

Explanation

The title "fix(layout): an Edge sheet's kicker reads on its paper" names the main change: the Edge sheet kicker now picks a text colour that stays readable on the paper. The changeset adds accent_ink, uses it in the Edge kicker style, documents it, and adds tests for it. The title is specific and conveys the primary change.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the problem, the fix, and the scope. It has a Testing section that lists new tests, commands run, and results. It has a UI evidence section with a before-and-after image for the visible kicker change, which the template requires. It links the issue with 'Closes #3301'. The template's 'Related issue' section is filled in. The description is complete.

Full details: Linked Issues check

Explanation

Issue #3301 asks that the Edge sheet kicker reach 4.5:1 against a dark paper, keep the accent's hue where possible, and leave an accent that already reads unchanged. At head, accent_ink in crates/engine/src/cmd/layout/publication/sheet.rs tries the accent first (step 0, unchanged), then mixes toward the paper's ink in 5% steps, returning the first mix with WCAG contrast of at least 4.5 against the paper. The Edge kicker in publication/mod.rs uses this function, per the PR summary. This meets the reported requirement. For the default accent #B4432E on #1B2430, the PR reports #C77665. The PR adds tests in crates/engine/src/tests/layout_edge.rs for the default accent, unreadable and readable accents, and a mid-grey paper. The test file and the mod.rs hunk were not read directly because the diff was unavailable, so the test results rely on the PR description and summary. The requirement is met by the code read at sheet.rs. The mid-grey fallback to the text colour is a documented design choice that the issue does not address.

Full details: Out of Scope Changes check

Explanation

The changes match the issue. sheet.rs adds accent_ink and the contrast helper. publication/mod.rs applies accent_ink to the Edge kicker only. The tests in layout_edge.rs cover this function. docs/user-guide/layouts.md documents the new behaviour. The PR description states that other styles, the wizard thumbnail accent bar, and the command interface are unchanged, and the code read at sheet.rs shows no changes to other styles. The mod.rs and test-file diffs were not directly readable, so unrelated edits in those hunks cannot be ruled out from source. That gap does not affect the verdict on the summary evidence.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the paper’s shade,
And nudges accents, gently made.
If contrast clears, the hue can stay,
If not, the ink will light the way.
The kicker hops, now clear to read.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3077eab5-1347-4a06-90e9-2d41fff9295b
Commits

Reviewing files that changed from the base of the PR and between 3021df9 and e0e97b7.

Files selected for processing: 4

  • crates/engine/src/cmd/layout/publication/mod.rs
  • crates/engine/src/cmd/layout/publication/sheet.rs
  • crates/engine/src/tests/layout_edge.rs
  • docs/user-guide/layouts.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

Comment thread crates/engine/src/tests/layout_edge.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues or AGENTS.md breaks in this change. I checked the sRGB-to-WCAG math by hand: the default accent #B4432E on #1B2430 first reaches 4.5:1 at the 6/20 mix, which gives #C77665 as the doc and test state. The kicker colour is also computed after the dark-paper branch has swapped ink, so it uses the right ink. The prior review file had no threads, so there were no earlier concerns to skip.

Bugs: none found. Confidence in the logic: high.

Security: none found.

Performance: none found. accent_ink does at most 20 contrast checks per sheet.

Quality

  • The WCAG contrast helper is now in sheet.rs, as a copy in layout_edge.rs, and block_model.rs:349 already linearises sRGB with the same constants. A shared Rgba method in rustgis-map would remove the copies. Confidence: high. (Inline comment on sheet.rs:229.)
  • The test helper copies the production formula, so the contrast assertions in the tests cannot catch an error in that formula. A test with fixed expected values would close the gap. Confidence: medium-high. (Inline comment on layout_edge.rs:152.)
  • The accent is recoloured with no notice to the user, so the sheet can show a different colour from the one requested. The docs describe this, and colour is not data, so the "Never silent" rule does not clearly apply. Confidence: low. Raised for discussion only, not as an inline comment.
  • Minor: the white literal Rgba::rgb(0xFF, 0xFF, 0xFF) at mod.rs:608 repeats the one at line 159. Not worth a separate comment.

AGENTS.md: no breaks found. The change touches no saved fields, so the schema and command-surface files need no update. It is engine-only with no cfg branches, so the wasm build is unaffected. The ink shadowing and the dark threshold are consistent with each other.

Surfaces and twins: the only accent text on a dark paper is the edge kicker, because paper is accepted only for edge sheets. The other accent texts (magazine title, column heading, panel head) sit on white paper, so they need no change. The PR's claim that it reaches the desktop, web, CLI, Python and Assistant without new parameters holds, since the change sits inside layout.publication.

Two inline comments are buffered and will post when the session completes. Both are quality items.

Change size

Compared with the base branch (merge base c5e1119 to PR head e0e97b7), covering the whole PR.

Measure Value
Files changed 4 (added 0, modified 4, removed 0, renamed 0)
Size before 252.6 KB
Size after 256.2 KB
Total size change +3.6 KB
Path Before After Change
crates/engine/src/tests/layout_edge.rs 16.2 KB 18.2 KB +2.0 KB
crates/engine/src/cmd/layout/publication/sheet.rs 9.1 KB 10.4 KB +1.3 KB
docs/user-guide/layouts.md 88.5 KB 88.6 KB +186 B
crates/engine/src/cmd/layout/publication/mod.rs 138.8 KB 138.9 KB +118 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3303/
Web app https://preview.rustgis.app/pr-3303/app/
Commit e0e97b7

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 29, 2026
Merged via the queue into opengeos:main with commit 69eeaee Nov 29, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3301-edge-accent-dark-paper branch November 29, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: An Edge sheet's kicker is hard to read on a dark paper

1 participant