This is the one commit (4f51a49) on feat/flextable-branding that never reached master: PR #10 merged this branch into feat/stamp-logo-png, but the commit wasn't carried along when feat/stamp-logo-png merged to master (PR #9). The branch is now exactly one commit ahead of master and not behind, so it merges cleanly.
What it adds
style_flextable_civilytics() — applies only the Civilytics visual brand to an already-structured flextable (header fill/color, body font/size, zebra striping guarded for < 2 rows, borders, footer). Every value is an overridable parameter; table structure (labels, widths, alignment) stays with the caller.
save_branded_flextable_png() — exports a styled flextable to PNG via ragg::agg_png() sized to the table plus extra_height, then optionally stamps the logo via stamp_logo_png().
flextable, officer, ragg added to Suggests (not Imports) to keep the base install light; both functions reference them fully qualified and guard with requireNamespace() + an install hint.
Full suite: 208 PASS / 0 FAIL (warnings are pre-existing testthat-2e deprecations).
flextable tests: 13 PASS / 0 FAIL.
Note
No version bump in this PR, to avoid a DESCRIPTION conflict with the other open PR (#15, which bumps to 0.3.0). Please reconcile the version when merging both.
Adds reusable Civilytics **flextable** branding helpers.
This is the one commit (`4f51a49`) on `feat/flextable-branding` that never reached `master`: PR #10 merged this branch into `feat/stamp-logo-png`, but the commit wasn't carried along when `feat/stamp-logo-png` merged to master (PR #9). The branch is now **exactly one commit ahead of master and not behind**, so it merges cleanly.
## What it adds
- **`style_flextable_civilytics()`** — applies only the Civilytics visual brand to an already-structured flextable (header fill/color, body font/size, zebra striping guarded for < 2 rows, borders, footer). Every value is an overridable parameter; table structure (labels, widths, alignment) stays with the caller.
- **`save_branded_flextable_png()`** — exports a styled flextable to PNG via `ragg::agg_png()` sized to the table plus `extra_height`, then optionally stamps the logo via `stamp_logo_png()`.
- `flextable`, `officer`, `ragg` added to **Suggests** (not Imports) to keep the base install light; both functions reference them fully qualified and guard with `requireNamespace()` + an install hint.
- roxygen man pages + `tests/testthat/test_flextable.R` (styling, 1-row idempotence, PNG export, `extra_height`).
## Verification
- Full suite: **208 PASS / 0 FAIL** (warnings are pre-existing testthat-2e deprecations).
- flextable tests: **13 PASS / 0 FAIL**.
## Note
No version bump in this PR, to avoid a `DESCRIPTION` conflict with the other open PR (#15, which bumps to 0.3.0). Please reconcile the version when merging both.
Generalize the flextable brand styling and "export to PNG + stamp logo"
pattern repeated across Civilytics projects into two small functions:
- style_flextable_civilytics(): applies only the visual brand (header
fill/color, body font/size, zebra striping guarded for <2 rows,
borders, footer styling, fixed layout) to an already-structured
flextable. Every value is an overridable parameter; zebra toggles
striping. Structure (labels, headers, widths, alignment, footer text)
stays with the caller.
- save_branded_flextable_png(): exports a styled flextable to PNG via
ragg::agg_png() sized to the table plus extra_height headroom, then
optionally stamps the logo via stamp_logo_png() (... forwarded).
flextable, officer, and ragg are added to Suggests (not Imports) to keep
the base install light; both functions reference them fully qualified and
guard with requireNamespace() + an install hint. Real round-trip tests
cover styling, 1-row idempotence, PNG export, and extra_height.
jared
merged commit 96dc1c4c6b into master2026-07-09 16:18:44 -04:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Adds reusable Civilytics flextable branding helpers.
This is the one commit (
4f51a49) onfeat/flextable-brandingthat never reachedmaster: PR #10 merged this branch intofeat/stamp-logo-png, but the commit wasn't carried along whenfeat/stamp-logo-pngmerged to master (PR #9). The branch is now exactly one commit ahead of master and not behind, so it merges cleanly.What it adds
style_flextable_civilytics()— applies only the Civilytics visual brand to an already-structured flextable (header fill/color, body font/size, zebra striping guarded for < 2 rows, borders, footer). Every value is an overridable parameter; table structure (labels, widths, alignment) stays with the caller.save_branded_flextable_png()— exports a styled flextable to PNG viaragg::agg_png()sized to the table plusextra_height, then optionally stamps the logo viastamp_logo_png().flextable,officer,raggadded to Suggests (not Imports) to keep the base install light; both functions reference them fully qualified and guard withrequireNamespace()+ an install hint.tests/testthat/test_flextable.R(styling, 1-row idempotence, PNG export,extra_height).Verification
Note
No version bump in this PR, to avoid a
DESCRIPTIONconflict with the other open PR (#15, which bumps to 0.3.0). Please reconcile the version when merging both.