feat: rebrand logos with wordmark/mark variants and pipe-friendly API
R-CMD-check / R CMD check (push) Successful in 2m39s
R-CMD-check / R CMD check (push) Successful in 2m39s
- 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
This commit is contained in:
+33
-10
@@ -160,20 +160,43 @@ test_that("theme_civilytics_dark uses navy for strip background", {
|
||||
|
||||
# --- make_logo_grob ----------------------------------------------------------
|
||||
|
||||
test_that("make_logo_grob returns a gg object for light variant", {
|
||||
logo <- make_logo_grob("light")
|
||||
expect_s3_class(logo, "gg")
|
||||
test_that("make_logo_grob returns a gg object for all type/variant combos", {
|
||||
for (type in c("wordmark", "mark")) {
|
||||
for (variant in c("light", "dark")) {
|
||||
logo <- make_logo_grob(type = type, variant = variant)
|
||||
expect_s3_class(logo, "gg")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test_that("make_logo_grob returns a gg object for dark variant", {
|
||||
logo <- make_logo_grob("dark")
|
||||
expect_s3_class(logo, "gg")
|
||||
})
|
||||
|
||||
test_that("make_logo_grob defaults to light variant", {
|
||||
test_that("make_logo_grob defaults to wordmark light", {
|
||||
expect_no_error(make_logo_grob())
|
||||
})
|
||||
|
||||
test_that("make_logo_grob errors on invalid type", {
|
||||
expect_error(make_logo_grob(type = "banner"))
|
||||
})
|
||||
|
||||
test_that("make_logo_grob errors on invalid variant", {
|
||||
expect_error(make_logo_grob("purple"))
|
||||
expect_error(make_logo_grob(variant = "purple"))
|
||||
})
|
||||
|
||||
# --- civilytics_logo (pipe-friendly) -----------------------------------------
|
||||
|
||||
test_that("civilytics_logo returns a grob", {
|
||||
p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme_civilytics()
|
||||
result <- suppressWarnings(civilytics_logo(p))
|
||||
expect_s3_class(result, "grob")
|
||||
})
|
||||
|
||||
test_that("civilytics_logo works with pipe operator", {
|
||||
p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme_civilytics()
|
||||
result <- suppressWarnings(p |> civilytics_logo())
|
||||
expect_s3_class(result, "grob")
|
||||
})
|
||||
|
||||
test_that("civilytics_logo accepts type and variant params", {
|
||||
p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme_civilytics_dark()
|
||||
result <- suppressWarnings(civilytics_logo(p, type = "mark", variant = "dark"))
|
||||
expect_s3_class(result, "grob")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user