feat: expand color system to 53 colors/10 palettes, add grid/slide themes, and README gallery
R-CMD-check / R CMD check (push) Successful in 3m41s
R-CMD-check / R CMD check (push) Successful in 3m41s
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.
This commit is contained in:
+27
-4
@@ -14,8 +14,10 @@ theme_civilytics(
|
||||
rel_large = 16/14,
|
||||
ink = unname(civilytics_colors["ink"]),
|
||||
paper = unname(civilytics_colors["paper"]),
|
||||
accent = unname(civilytics_colors["accent"]),
|
||||
strip_color = unname(civilytics_colors["paper_2"])
|
||||
accent = unname(civilytics_colors["ember_600"]),
|
||||
strip_color = unname(civilytics_colors["paper_2"]),
|
||||
grid = c("y", "x", "both", "none"),
|
||||
paper_bg = TRUE
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
@@ -45,10 +47,18 @@ Default `11/14`.}
|
||||
[civilytics_colors]`["paper"]` (`#FAF7F2`).}
|
||||
|
||||
\item{accent}{Character. Hex code for accent/highlight color. Defaults to
|
||||
[civilytics_colors]`["accent"]` (`#C25311`).}
|
||||
[civilytics_colors]`["ember_600"]` (`#C25311`).}
|
||||
|
||||
\item{strip_color}{Character. Hex code for facet strip background. Defaults
|
||||
to [civilytics_colors]`["paper_2"]` (`#F2EDE4`).}
|
||||
|
||||
\item{grid}{Character. Which major gridlines to draw: `"y"` (default,
|
||||
horizontal only), `"x"` (vertical only), `"both"`, or `"none"`.}
|
||||
|
||||
\item{paper_bg}{Logical. If `TRUE` (default), fill the plot and panel
|
||||
backgrounds with the warm `paper` color. Set to `FALSE` for a
|
||||
transparent background (useful for slides or overlay on colored
|
||||
surfaces).}
|
||||
}
|
||||
\value{
|
||||
A complete ggplot2 [ggplot2::theme()] object.
|
||||
@@ -59,6 +69,11 @@ Civilytics brand color palette and typography. Requires ggplot2 >= 4.0.0
|
||||
for the `ink`, `paper`, and `accent` base-theme parameters.
|
||||
}
|
||||
\details{
|
||||
Produces an editorial, Pew-style layout: visible x-axis line to ground
|
||||
the data, light horizontal gridlines for reference, no panel border or
|
||||
y-axis line. Plot title and caption are left-aligned to the full plot
|
||||
region.
|
||||
|
||||
Brand fonts (Inter for UI text, Libre Franklin for titles) are loaded
|
||||
automatically via [showtext] when the package is attached. Call
|
||||
[civilytics_load_fonts()] to reload them if needed.
|
||||
@@ -66,13 +81,21 @@ automatically via [showtext] when the package is attached. Call
|
||||
\examples{
|
||||
\dontrun{
|
||||
library(ggplot2)
|
||||
|
||||
# Default editorial theme
|
||||
ggplot(mpg, aes(displ, hwy)) +
|
||||
geom_point() +
|
||||
theme_civilytics()
|
||||
|
||||
# With both gridlines and brand colors
|
||||
ggplot(mpg, aes(displ, hwy, colour = class)) +
|
||||
geom_point() +
|
||||
scale_color_civilytics() +
|
||||
theme_civilytics()
|
||||
theme_civilytics(grid = "both")
|
||||
|
||||
# Transparent background for embedding
|
||||
ggplot(mpg, aes(displ, hwy)) +
|
||||
geom_point() +
|
||||
theme_civilytics(paper_bg = FALSE)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user