theme_civilytics(): default to a transparent background, opt-in for Civilytics cream #7

Closed
opened 2026-06-08 16:18:34 -04:00 by jared · 26 comments
Owner

Summary

theme_civilytics() currently paints the Civilytics cream paper (#FAF7F2) as the default plot.background and panel.background (via paper_bg = TRUE). Request: flip the default to a transparent background, keeping the cream as an explicit opt-in.

Why

Figures are most reusable when their background is transparent — they composite cleanly onto report pages, slides, and web backgrounds of any color. A baked-in cream fill forces every downstream consumer to override it.

We hit this in the crdc-arrests white paper: to get transparent figures we had to call theme_civilytics(paper_bg = FALSE) and set a transparent graphics device (dev = "ragg_png", dev.args = list(background = "transparent")), because the cream comes from the theme's plot.background / panel.background fills.

Proposal

  • Default theme_civilytics() to transparent (plot.background / panel.background / legend.background fill = NA).
  • Keep cream as an explicit opt-in — e.g. flip paper_bg to default FALSE, or (clearer) add a background = c("transparent", "paper") argument so users enable the branded cream canvas deliberately.
  • Document that a transparent device background is also needed for fully-transparent PNGs (the theme alone cannot make the device canvas transparent).

Notes

  • The machinery already exists: theme_civilytics(paper_bg = FALSE) yields fill = NA for plot/panel/legend backgrounds — so this is a default-flip plus (optionally) a friendlier argument name.
  • Related: the logo helpers (add_logo() / civilytics_logo() / make_logo_grob()) and footer/overlay placement interact with background color; a transparent default avoids surprising cream bands behind composited logos.
## Summary `theme_civilytics()` currently paints the Civilytics cream paper (`#FAF7F2`) as the default `plot.background` and `panel.background` (via `paper_bg = TRUE`). Request: **flip the default to a transparent background**, keeping the cream as an explicit opt-in. ## Why Figures are most reusable when their background is transparent — they composite cleanly onto report pages, slides, and web backgrounds of any color. A baked-in cream fill forces every downstream consumer to override it. We hit this in the `crdc-arrests` white paper: to get transparent figures we had to call `theme_civilytics(paper_bg = FALSE)` **and** set a transparent graphics device (`dev = "ragg_png"`, `dev.args = list(background = "transparent")`), because the cream comes from the theme's `plot.background` / `panel.background` fills. ## Proposal - Default `theme_civilytics()` to **transparent** (`plot.background` / `panel.background` / `legend.background` fill = `NA`). - Keep cream as an explicit opt-in — e.g. flip `paper_bg` to default `FALSE`, or (clearer) add a `background = c("transparent", "paper")` argument so users enable the branded cream canvas deliberately. - Document that a transparent **device** background is also needed for fully-transparent PNGs (the theme alone cannot make the device canvas transparent). ## Notes - The machinery already exists: `theme_civilytics(paper_bg = FALSE)` yields `fill = NA` for plot/panel/legend backgrounds — so this is a default-flip plus (optionally) a friendlier argument name. - Related: the logo helpers (`add_logo()` / `civilytics_logo()` / `make_logo_grob()`) and footer/overlay placement interact with background color; a transparent default avoids surprising cream bands behind composited logos.
kodor was assigned by jared 2026-06-17 19:06:09 -04:00
Member

kodor produced no usable change (attempt 1/2); will retry next run.

kodor produced no usable change (attempt 1/2); will retry next run. <!-- kodor:attempt=1 -->
Member

kodor produced no usable change (opencode exited 0 with no file changes; attempt 2/2). Handing back — reassign me to retry.

kodor produced no usable change (opencode exited 0 with no file changes; attempt 2/2). Handing back — reassign me to retry. <!-- kodor:attempt=2 -->
kodor removed their assignment 2026-06-18 08:44:57 -04:00
kodor was assigned by jared 2026-06-18 09:40:14 -04:00
Member

Reviewer (round 1) requested changes:

VERDICT: approve

Reviewer (round 1) requested changes: VERDICT: approve
Member

Reviewer (round 2) requested changes:

Checklist from issue:

  1. Default theme_civilytics() to transparent (plot.background / panel.background / legend.background fill = NA)

    • paper_bg = FALSE default at R/theme.R:107 ✓
    • bg_color <- if (isTRUE(paper_bg)) paper else NA at line 115 ✓
    • plot.background and panel.background use bg_color at lines 269, 240 ✓
    • legend.background = element_blank() at line 213 — already transparent (equivalent to fill = NA) ✓
  2. Keep cream as explicit opt-in via paper_bg = FALSE default ✓ (line 107)

  3. Documentation updated ✓ — roxygen for paper_bg rewritten (lines 40-44), examples flipped (lines 73-87)

  4. Tests — two new tests added: transparent default (lines 136-140) and paper_bg=TRUE opt-in (lines 142-146). Existing paper_bg=FALSE test preserved (line 188). ✓

  5. Variant themes — theme_civilytics_dark, _map, _dark_map keep paper_bg = TRUE; _slide, _slide_map keep paper_bg = FALSE. All consistent. ✓

  6. CI failure — pdflatex not found / PDF manual build warning is unrelated to this diff. Not a blocker.

VERDICT: approve

Reviewer (round 2) requested changes: **Checklist from issue:** 1. **Default `theme_civilytics()` to transparent** (`plot.background` / `panel.background` / `legend.background` fill = `NA`) - `paper_bg = FALSE` default at `R/theme.R:107` ✓ - `bg_color <- if (isTRUE(paper_bg)) paper else NA` at line 115 ✓ - `plot.background` and `panel.background` use `bg_color` at lines 269, 240 ✓ - `legend.background = element_blank()` at line 213 — already transparent (equivalent to `fill = NA`) ✓ 2. **Keep cream as explicit opt-in via `paper_bg = FALSE` default** ✓ (line 107) 3. **Documentation updated** ✓ — roxygen for `paper_bg` rewritten (lines 40-44), examples flipped (lines 73-87) 4. **Tests** — two new tests added: transparent default (lines 136-140) and `paper_bg=TRUE` opt-in (lines 142-146). Existing `paper_bg=FALSE` test preserved (line 188). ✓ 5. **Variant themes** — `theme_civilytics_dark`, `_map`, `_dark_map` keep `paper_bg = TRUE`; `_slide`, `_slide_map` keep `paper_bg = FALSE`. All consistent. ✓ 6. **CI failure** — `pdflatex not found` / PDF manual build warning is unrelated to this diff. Not a blocker. VERDICT: approve
Member

Reviewer (round 3) requested changes:

VERDICT: approve

Reviewer (round 3) requested changes: VERDICT: approve
Member

Reviewer (round 4) requested changes:

VERDICT: approve

Reviewer (round 4) requested changes: VERDICT: approve
Member

Reviewer (round 5) requested changes:

Checklist from issue:

  1. Default to transparent (plot.background / panel.background / legend.background fill = NA): ✓

    • paper_bg = FALSE default at R/theme.R:107
    • bg_color <- if (isTRUE(paper_bg)) paper else NA at line 115
    • plot.background (line 269) and panel.background (line 240) use bg_color → NA when paper_bg = FALSE
    • legend.background is element_blank() (line 213) — already transparent
  2. Cream as explicit opt-in (paper_bg = TRUE): ✓ — documented, tested, examples updated

  3. Document transparent device background needed for PNGs: ✗ — not present in roxygen docs

Tests: New tests cover transparent default and paper_bg = TRUE opt-in. Adequate.

CI: Failing with 1 WARNING. Authoritative blocker per review rules. The quarto removal from Suggests (DESCRIPTION) coincides with extensive quarto assets in inst/quarto/ and exported functions in R/quarto.R — likely the WARNING source, but unverified without the full check log.

quarto removal concern: DESCRIPTION line 11-12 still references "Quarto themes" in the package description, and R/quarto.R exports use_civilytics_revealjs(), use_civilytics_theme(), use_civilytics_brand(). Removing quarto from Suggests while these exist is suspicious and likely causing the CI WARNING.

VERDICT: request_changes

Reviewer (round 5) requested changes: **Checklist from issue:** 1. **Default to transparent** (`plot.background` / `panel.background` / `legend.background` fill = `NA`): ✓ - `paper_bg = FALSE` default at `R/theme.R:107` - `bg_color <- if (isTRUE(paper_bg)) paper else NA` at line 115 - `plot.background` (line 269) and `panel.background` (line 240) use `bg_color` → `NA` when `paper_bg = FALSE` - `legend.background` is `element_blank()` (line 213) — already transparent 2. **Cream as explicit opt-in** (`paper_bg = TRUE`): ✓ — documented, tested, examples updated 3. **Document transparent device background needed for PNGs**: ✗ — not present in roxygen docs **Tests:** New tests cover transparent default and `paper_bg = TRUE` opt-in. Adequate. **CI:** Failing with 1 WARNING. Authoritative blocker per review rules. The `quarto` removal from Suggests (DESCRIPTION) coincides with extensive quarto assets in `inst/quarto/` and exported functions in `R/quarto.R` — likely the WARNING source, but unverified without the full check log. **`quarto` removal concern:** DESCRIPTION line 11-12 still references "Quarto themes" in the package description, and `R/quarto.R` exports `use_civilytics_revealjs()`, `use_civilytics_theme()`, `use_civilytics_brand()`. Removing `quarto` from Suggests while these exist is suspicious and likely causing the CI WARNING. VERDICT: request_changes
Member

kodor could not converge in 5 review rounds — rolled back off the nightly branch; needs a human.

kodor could not converge in 5 review rounds — rolled back off the nightly branch; needs a human.
Member

Reviewer (round 1) approved, but CI is timeout — holding for green.

Reviewer (round 1) approved, but CI is timeout — holding for green.
Member

Reviewer (round 2) approved, but CI is timeout — holding for green.

Reviewer (round 2) approved, but CI is timeout — holding for green.
Member

Reviewer (round 3) approved, but CI is timeout — holding for green.

Reviewer (round 3) approved, but CI is timeout — holding for green.
Member

Reviewer (round 4) approved, but CI is timeout — holding for green.

Reviewer (round 4) approved, but CI is timeout — holding for green.
Member

Reviewer (round 5) approved, but CI is timeout — holding for green.

Reviewer (round 5) approved, but CI is timeout — holding for green.
Member

kodor could not converge in 5 review rounds — rolled back off the nightly branch; needs a human.

kodor could not converge in 5 review rounds — rolled back off the nightly branch; needs a human.
Member

Reviewer (round 1) approved, but CI is timeout — holding for green.

Reviewer (round 1) approved, but CI is timeout — holding for green.
Member

Reviewer (round 2) approved, but CI is timeout — holding for green.

Reviewer (round 2) approved, but CI is timeout — holding for green.
Member

Reviewer (round 3) approved, but CI is timeout — holding for green.

Reviewer (round 3) approved, but CI is timeout — holding for green.
Member

Reviewer (round 4) approved, but CI is timeout — holding for green.

Reviewer (round 4) approved, but CI is timeout — holding for green.
Member

Reviewer (round 5) approved, but CI is timeout — holding for green.

Reviewer (round 5) approved, but CI is timeout — holding for green.
Member

kodor could not converge in 5 review rounds — rolled back off the nightly branch; needs a human.

kodor could not converge in 5 review rounds — rolled back off the nightly branch; needs a human.
Member

Reviewer (round 1) requested changes:

Issue #7 Checklist:

  1. Default to transparent (plot.background / panel.background / legend.background fill = NA)

    • paper_bg = FALSE default ✓ (line 104)
    • bg_color = NA when paper_bg = FALSE ✓ (line 112)
    • plot.background / panel.background use bg_color ✓ (lines 237, 266)
    • legend.background = element_blank() ✓ (line 210)
    • Missing test: no test asserts legend.background is transparent/blank by default
  2. Cream as explicit opt-in (paper_bg = TRUE)

    • paper_bg = TRUE fills with cream ✓ (line 112)
    • Tests added for paper_bg = TRUE ✓ (lines 142-146)
  3. Documentation updated

    • @param paper_bg docstring flipped ✓ (lines 39-41)
    • Examples reordered: transparent first, cream opt-in second ✓ (lines 70-78)
    • Removed old "transparent background for embedding" example ✓
    • Missing: issue asks to document that a transparent device background is also needed for fully-transparent PNGs — this note does not appear in the roxygen doc

Verdict: Two gaps: (1) no test for legend.background transparency, and (2) the device-transparency note from the proposal is not documented.

VERDICT: request_changes

Reviewer (round 1) requested changes: **Issue #7 Checklist:** 1. **Default to transparent** (`plot.background` / `panel.background` / `legend.background` fill = `NA`) - `paper_bg = FALSE` default ✓ (line 104) - `bg_color = NA` when `paper_bg = FALSE` ✓ (line 112) - `plot.background` / `panel.background` use `bg_color` ✓ (lines 237, 266) - `legend.background = element_blank()` ✓ (line 210) - **Missing test**: no test asserts `legend.background` is transparent/blank by default 2. **Cream as explicit opt-in** (`paper_bg = TRUE`) - `paper_bg = TRUE` fills with cream ✓ (line 112) - Tests added for `paper_bg = TRUE` ✓ (lines 142-146) 3. **Documentation updated** - `@param paper_bg` docstring flipped ✓ (lines 39-41) - Examples reordered: transparent first, cream opt-in second ✓ (lines 70-78) - Removed old "transparent background for embedding" example ✓ - **Missing**: issue asks to document that a transparent **device** background is also needed for fully-transparent PNGs — this note does not appear in the roxygen doc **Verdict:** Two gaps: (1) no test for `legend.background` transparency, and (2) the device-transparency note from the proposal is not documented. VERDICT: request_changes
Member

Reviewer (round 2) approved, but CI is timeout — holding for green.

Reviewer (round 2) approved, but CI is timeout — holding for green.
Member

Reviewer (round 3) approved, but CI is timeout — holding for green.

Reviewer (round 3) approved, but CI is timeout — holding for green.
Member

Reviewer (round 4) approved, but CI is timeout — holding for green.

Reviewer (round 4) approved, but CI is timeout — holding for green.
Member

Reviewer (round 5) output was unreadable after a retry — treating as request_changes.

Reviewer (round 5) output was unreadable after a retry — treating as request_changes.
Member

kodor could not converge in 5 review rounds — work parked on kodor/park-20260704-7; needs a human.

kodor could not converge in 5 review rounds — work parked on `kodor/park-20260704-7`; needs a human.
kodor was unassigned by jared 2026-07-05 09:03:11 -04:00
jared added the kodorkodor/fix labels 2026-07-28 11:10:28 -04:00
kodor added the kodor/triaged label 2026-07-29 02:07:49 -04:00
kodor was assigned by jared 2026-07-29 07:02:23 -04:00
kodor added kodor/needs-reviewkodor/needs-review and removed kodor/fix labels 2026-08-01 02:09:57 -04:00
jared closed this issue 2026-08-03 10:47:06 -04:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Civilytics/civilyticsR#7