feat(flextable): add reusable Civilytics flextable branding helpers
R-CMD-check / R CMD check (pull_request) Successful in 4m20s
R-CMD-check / R CMD check (pull_request) Successful in 4m20s
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.
This commit is contained in:
@@ -39,11 +39,13 @@ export(rnh)
|
||||
export(round_to_nearest_half)
|
||||
export(safe_max)
|
||||
export(safe_ratio)
|
||||
export(save_branded_flextable_png)
|
||||
export(scale_color_civilytics)
|
||||
export(scale_fill_civilytics)
|
||||
export(simpleCap)
|
||||
export(stamp_logo_png)
|
||||
export(star_subs)
|
||||
export(style_flextable_civilytics)
|
||||
export(theme_civilytics)
|
||||
export(theme_civilytics_dark)
|
||||
export(theme_civilytics_dark_map)
|
||||
|
||||
Reference in New Issue
Block a user