Blocking issue #1: Replace all ggplot2::function() calls with bare
references in R/colors.R, R/logo.R, R/theme.R. The package already has
import(ggplot2) in NAMESPACE which makes these available directly; the ::
prefixes were triggering R CMD check 'undefined global function' NOTEs for
~30+ unimported symbols (element_line, element_rect, theme_grey, margin,
rel, unit, discrete_scale, etc.).
Suggestion #6: Replace class(x) == "character" with "character" %in% class(x)
in R/db.R (countCleanr and simpleCap). The == pattern breaks on S3 objects
with multiple class attributes.
Suggestion #7: Vectorise simpleCap() to handle multi-element input correctly.
Previously strsplit(x, ' ')[[1]] only processed the first element; now uses
unname(vapply()) to capitalise each vector element independently while
preserving the original scalar behaviour (no names attribute on output).
Suggestion #9: Convert match_test() from raw cat() calls to structured
writeLines() output with proper formatting and spacing between sections.
- Remove Knowles_Headshot_2019_good.jpg and Knowles_Headshot_2019_prisma.jpg
from inst/img/ — personal headshot should not be distributed with the package
- Update plot_jpeg() roxygen example to use a generic placeholder instead of
the removed headshot path; regenerate man/plot_jpeg.Rd accordingly
- Add comprehensive testthat coverage for clopper_pearson(), z_univariate(),
waldInterval(), and agresti_coull_interval() in tests/testthat/test_propint.R
The propint module previously had zero tests. New tests cover: return types,
formula correctness (cross-validated against binom.test()), edge cases
(0/n and n/n), interval validity, confidence level behavior, and sign/direction
of z-scores.
- Replace .cv_fonts_loaded <<- TRUE with environment-based state
(.cv_state) to avoid 'locked namespace binding' error (#18)
- Add force=FALSE argument for idempotent font loading with guard check
- Flip theme_civilytics() paper_bg default to FALSE (transparent) (#7)
- Update roxygen docs and examples for both changes
The single-file `template: civilytics-typst.typ` discarded Quarto's
auto-generated `definitions` partial, so any Typst document containing a
code block failed with `unknown variable: Skylighting`.
Ship the template as Quarto template-partials instead, so Quarto keeps its
definitions (Skylighting + token functions) and syntax-highlighted code
blocks render while the Civilytics branding still applies:
- split civilytics-typst.typ into typst-template.typ (the styling function)
and typst-show.typ (the show/entry point, keyword-safe [ ] wrapping kept);
remove the single-file template
- use_civilytics_theme() now copies both partials and prints the
template-partials usage
- example report.qmd uses template-partials
Verified: a report with an R code block renders with working syntax
highlighting and full branding.
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.
civilytics_logo()/make_logo_grob() brand ggplot/grobs, but flextables and
other outputs are rendered to PNG first and can't use them. stamp_logo_png()
is the raster analogue: it resolves the SAME brand asset that make_logo_grob()
uses (via the type/variant switch) and composites it into a corner of an
existing PNG in place, so file-based tables stay visually consistent with
logo-branded plots.
Dependency-free by design — uses only png + grid + grDevices (all already
imported), no magick. Configurable type/variant/position/width/margin;
preserves the image's pixel dimensions. Adds tests (21 assertions).
Use system2() with separate args instead of shell-interpolated system()
calls in .send_desktop_notify() and .send_webhook(). This eliminates
command injection risk when msg, status, url, or payload contain shell
metacharacters.
- #5: Unwrap _brand.yml for Quarto 1.9+ compatibility (remove top-level
brand: wrapper so meta/logo/color/typography are at the top level)
- #1: Add quiet parameter to na_sum() to suppress warnings in loops/pipelines
- #3: Add beep() function for CLI beep, desktop notifications, and webhook
alerts (supports type=beep|notify|webhook|all)
Integrate Civilytics Reveal.js slide extension, HTML/PDF/Typst document
themes, and _brand.yml into the package under inst/quarto/. Three new
helper functions (use_civilytics_revealjs, use_civilytics_theme,
use_civilytics_brand) copy assets into a user's Quarto project. Logos
are stored once in inst/img/ and distributed at install time.
The previous fix applied the plot's background to the logo grob
directly, which made it opaque and covered caption/axis text that
overlaps into the logo area via negative margins.
Instead, wrap the entire arrangeGrob composition in a grobTree with
a background rectGrob behind it. This fills transparent areas (logo
strip, padding gaps) with the plot's background color while keeping
the logo grob itself transparent so overlapping text remains visible.
The logo grob uses theme_void() (transparent background), so when
arrangeGrob() composites it with a dark-themed plot, the logo strip
falls back to the device default (white). Extract the plot's
plot.background fill and apply it to the logo grob before compositing.
Fixes the issue where theme_civilytics_dark(font_size = 16) piped to
civilytics_logo(variant = "dark") would show a light background in
the logo/caption area.
Add theme_civilytics_map(), theme_civilytics_dark_map(), and
theme_civilytics_slide_map() for choropleths — suppress axes, ticks,
gridlines, and axis labels while preserving titles, captions, and legends.
Fix subtitle, caption, and axis text colors in theme_civilytics_dark()
which were inheriting dark ink_2/ink_3 values meant for light backgrounds,
making them hard to read on navy. Now uses navy_200/navy_300 instead.
Supports "bottom-right" (default), "bottom-left", "top-right", and
"top-left". The position controls both horizontal alignment of the logo
grob and whether it is placed above or below the plot.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The old fig.retina=2 at 150 DPI rendered PNGs at 2x resolution that
GitHub markdown can't use, making text appear half its intended size.
Switching to 96 DPI without retina produces images at their natural
display size. Combined with the base font bump (14 → 16pt), titles
and labels now render with proper editorial presence.
- Change rel_large default from 16/14 to 20/14 (~1.43x) to match the
Civilytics editorial design system. Subtitle now renders at 1.0x base
instead of 0.86x.
- Switch axis.text to rel() sizing so all text elements cascade from the
root font_size, enabling uniform scaling.
- Add font_scale parameter (default 1.1) to civilytics_logo(),
add_logo(), and add_logo_ga() — inflates text by ~10% before
arrangeGrob composition to compensate for viewport shrinkage.
- Ship SVG logo variants (mark, wordmark, pulse) in inst/img/ for
Quarto/HTML templates.
- Add "Maintaining brand assets" section to README documenting inst/img/
file inventory and update workflow.
- Document full font size hierarchy in theme_civilytics() roxygen.
Replace the 16-color / 3-palette system with the full Civilytics design
system: 53 named colors (full navy, ember, violet ramps plus teal, plum,
moss, brass supporting hues) and 10 visualization palettes (qual,
qual_warm, qual_cool, seq_ember, seq_navy, seq_violet, seq_paper_ink,
div_navy_ember, div_violet_ember).
Enrich theme_civilytics() with grid and paper_bg parameters, add
theme_civilytics_slide() for presentations, and load all four brand fonts
(Inter, Libre Franklin, Source Serif 4, JetBrains Mono).
Add README.Rmd with rendered gallery showing all palettes, theme
variants, grid options, dark/slide modes, facets, and scale usage.
R's |> has higher precedence than +, so parentheses ARE required
around the ggplot chain before piping to civilytics_logo():
(ggplot(df, aes(x, y)) + geom_point() + theme_civilytics()) |>
civilytics_logo()
Updated docs, examples, and pipe test accordingly.
- Replace old civilytics_logo.png/white.png/jpg/pdf with new rebrand
assets: civilytics-wordmark.png, civilytics-wordmark-reverse.png,
civilytics-mark.png, civilytics-mark-reverse.png (all transparent bg)
- make_logo_grob() now accepts type = c("wordmark", "mark") alongside
variant = c("light", "dark") for 4 combinations
- New civilytics_logo() pipe-friendly convenience function:
ggplot(df, aes(x, y)) + geom_point() + theme_civilytics() |>
civilytics_logo()
R's |> has lower precedence than +, so the full ggplot chain pipes
through without parentheses
- Remove old icon/favicon assets no longer used
- Wrap showtext-dependent examples in \dontrun{} to prevent R CMD check
failures in headless PostScript environments
- R/colors.R: civilytics_colors named vector (from --cv-* CSS vars on
civilytics.com), three palettes (main/sequential/diverging),
scale_color_civilytics() and scale_fill_civilytics() for ggplot2
- R/fonts.R: auto-loads Inter + Libre Franklin from Google Fonts via
showtext in .onLoad(); exports civilytics_load_fonts() for manual retry
- R/theme.R: wires ggplot2 4.0 ink/paper/accent params into theme_grey()
base, adds title_family + strip_color params; new theme_civilytics_dark()
using navy_dark background and warm off-white text
- R/logo.R: make_logo_grob(variant) accepts "light"/"dark" to select the
white logo for dark-background compositions
- DESCRIPTION: adds showtext, sysfonts; pins ggplot2 >= 4.0.0
- tests/testthat/test_theme.R: full test suite for colors, palettes,
scales, both theme variants, and logo grob variants
theme.R:
- Remove deprecated legend.text.align and legend.title.align (ggplot2 3.5.0)
- Remove stale @importFrom graphics plot (unused in theme function)
logo.R:
- Fix make_logo_grob() spurious two-row data frame (drop aes/data from canvas)
- Fix add_logo_ga() caption measurement always using first plot; now uses max
across all plots with captions
- Fix add_logo_ga() ncol hardcoded to 2; now uses length(plot_list)
- Fix add_logo_ga() widths silently ignored in nrow > 1 path; now warns
- Replace deprecated qplot() in examples with ggplot() equivalents
- Fix native = T -> TRUE in plot_jpeg()
@importFrom does not work for base R lazy data objects — replaced with
utils::globalVariables() in the package file to suppress the R CMD check
NOTE. Removed the invalid @importFrom datasets tag from utils.R.
Also commits all man/ and NAMESPACE changes from devtools::document().
- Wrap get_fips/get_stabbr examples in dontrun (tidycensus is Suggests)
- Add .gitea to .Rbuildignore (hidden dir note)
- Add importFrom(datasets, state.abb/state.name) for postcode_lookup
- Remove LazyData: true (no data/ directory)
- Add real R CMD check workflow via Gitea Actions (rocker/r-ver:4.4)
- Remove Jenkinsfile and demo workflow
- Modernize DESCRIPTION: Authors@R, R >= 4.1.0, URL/BugReports fields,
move tidycensus from Imports to Suggests, testthat edition 3
- Fix agresti_coull_interval: correct implementation, export it
- Convert get_fips/get_stabbr to use requireNamespace for tidycensus
- Remove civilytics:: self-reference in rnh()