feat: add brand color system, showtext fonts, and dark theme
R-CMD-check / R CMD check (push) Failing after 1m39s

- 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
This commit is contained in:
2026-05-17 10:36:59 -06:00
parent 2d70d9aecf
commit c93c469267
17 changed files with 996 additions and 206 deletions
+29
View File
@@ -0,0 +1,29 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/colors.R
\name{civilytics_pal}
\alias{civilytics_pal}
\title{Civilytics brand color palette}
\usage{
civilytics_pal(name = "main", n = NULL)
}
\arguments{
\item{name}{Character. Palette name: `"main"`, `"sequential"`, or
`"diverging"`. Defaults to `"main"`.}
\item{n}{Integer or `NULL`. Number of colors to return. If `NULL`, returns
all colors in the palette. If `n` exceeds the number of defined stops,
colors are interpolated via [grDevices::colorRampPalette()].}
}
\value{
A character vector of hex color codes.
}
\description{
Returns a character vector of hex codes from a named Civilytics palette.
Available palettes: `"main"` (qualitative, up to 6), `"sequential"` (light
to dark navy), `"diverging"` (orange–neutral–navy).
}
\examples{
civilytics_pal() # all 6 qualitative colors
civilytics_pal("sequential", n = 3)
civilytics_pal("diverging", n = 5)
}