* Increment version number to 0.4.3 * chore: add cran comments * Fix indents and invisible characters (GitHub Actions) * Re-build README.Rmd (GitHub Actions) * Re-build index.Rmd (GitHub Actions) * chore: urlchecker::url_update() * chore: align and register s3 print methods * tests: Update and fix tests * docs: update link in thanks --------- Co-authored-by: gadenbuie <gadenbuie@users.noreply.github.com>tags/v0.4.3
| .history/ | .history/ | ||||
| # Directories that start with _ | # Directories that start with _ | ||||
| _*/ | |||||
| /_*/ | |||||
| ## https://github.com/github/gitignore/blob/master/R.gitignore | ## https://github.com/github/gitignore/blob/master/R.gitignore | ||||
| # History files | # History files |
| Type: Package | Type: Package | ||||
| Package: xaringanthemer | Package: xaringanthemer | ||||
| Title: Custom 'xaringan' CSS Themes | Title: Custom 'xaringan' CSS Themes | ||||
| Version: 0.4.2.9000 | |||||
| Version: 0.4.3 | |||||
| Authors@R: | Authors@R: | ||||
| person("Garrick", "Aden-Buie", , "garrick@adenbuie.com", role = c("aut", "cre"), | person("Garrick", "Aden-Buie", , "garrick@adenbuie.com", role = c("aut", "cre"), | ||||
| comment = c(ORCID = "0000-0002-7111-0077")) | comment = c(ORCID = "0000-0002-7111-0077")) |
| # Generated by roxygen2: do not edit by hand | # Generated by roxygen2: do not edit by hand | ||||
| S3method(print,google_font) | |||||
| S3method(print,xaringanthemer_default) | |||||
| export(apply_alpha) | export(apply_alpha) | ||||
| export(choose_dark_or_light) | export(choose_dark_or_light) | ||||
| export(darken_color) | export(darken_color) |
| # xaringanthemer (development version) | |||||
| # xaringanthemer 0.4.3 | |||||
| - Update the spelling of `colour` for compatibility with ggplot2 >= 3.5.1 (@teunbrand #79). | - Update the spelling of `colour` for compatibility with ggplot2 >= 3.5.1 (@teunbrand #79). | ||||
| #' A Plot Theme for ggplot2 by xaringanthemer | #' A Plot Theme for ggplot2 by xaringanthemer | ||||
| #' | #' | ||||
| #' @description | #' @description |
| if (is.null(names(css))) { | if (is.null(names(css))) { | ||||
| stop("All elements in `css` list must be named", call. = FALSE) | stop("All elements in `css` list must be named", call. = FALSE) | ||||
| } | } | ||||
| if (purrr::vec_depth(css) != 3) { | |||||
| if (purrr::pluck_depth(css) != 3) { | |||||
| stop(str_wrap( | stop(str_wrap( | ||||
| "`css` list must be a named list within a named list, e.g.:\n", | "`css` list must be a named list within a named list, e.g.:\n", | ||||
| ' list(".class-id" = list("css-property" = "value"))' | ' list(".class-id" = list("css-property" = "value"))' |
| x | x | ||||
| } | } | ||||
| print.xaringanthemer_default <- function(x) { | |||||
| #' @export | |||||
| print.xaringanthemer_default <- function(x, ...) { | |||||
| print(unclass(x)) | print(unclass(x)) | ||||
| } | } |
| unique(match.arg(language_codes, several.ok = TRUE)) | unique(match.arg(language_codes, several.ok = TRUE)) | ||||
| } | } | ||||
| print.google_font <- function(x) { | |||||
| #' @export | |||||
| print.google_font <- function(x, ...) { | |||||
| cat( | cat( | ||||
| "Family: ", | "Family: ", | ||||
| x$family, | x$family, |
| [](https://gadenbuie.r-universe.dev) | [](https://gadenbuie.r-universe.dev) | ||||
| [](https://lifecycle.r-lib.org/articles/stages.html) | [](https://lifecycle.r-lib.org/articles/stages.html) | ||||
| [](https://github.com/gadenbuie/xaringanthemer/actions) | [](https://github.com/gadenbuie/xaringanthemer/actions) | ||||
| [](https://codecov.io/github/gadenbuie/xaringanthemer) | |||||
| [](https://app.codecov.io/github/gadenbuie/xaringanthemer) | |||||
| <!-- badges: end --> | <!-- badges: end --> | ||||
| ```{r child="man/fragments/_tagline-gif.Rmd"} | ```{r child="man/fragments/_tagline-gif.Rmd"} |
| stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) | stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html) | ||||
| [](https://github.com/gadenbuie/xaringanthemer/actions) | badge](https://github.com/gadenbuie/xaringanthemer/workflows/R-CMD-check/badge.svg?branch=main)](https://github.com/gadenbuie/xaringanthemer/actions) | ||||
| [](https://codecov.io/github/gadenbuie/xaringanthemer) | |||||
| [](https://app.codecov.io/github/gadenbuie/xaringanthemer) | |||||
| <!-- badges: end --> | <!-- badges: end --> | ||||
| Give your [xaringan](https://github.com/yihui/xaringan) slides some | Give your [xaringan](https://github.com/yihui/xaringan) slides some | ||||
| ## Features | ## Features | ||||
| There’s a lot more that **xaringanthemer** can do\! [Discover | |||||
| There’s a lot more that **xaringanthemer** can do! [Discover | |||||
| xaringanthemer’s | xaringanthemer’s | ||||
| features.](https://pkg.garrickadenbuie.com/xaringanthemer/articles/xaringanthemer.html) | features.](https://pkg.garrickadenbuie.com/xaringanthemer/articles/xaringanthemer.html) |
| ## R CMD check results | |||||
| 0 errors | 0 warnings | 0 note | |||||
| This is a minor maintenance release to address changes in ggplot2. |
| **xaringanthemer** is <kbd>Tab</kbd> friendly – [use autocomplete to | **xaringanthemer** is <kbd>Tab</kbd> friendly – [use autocomplete to | ||||
| explore](#theme-settings) the [template | explore](#theme-settings) the [template | ||||
| variables](vignettes/template-variables.md) that you can adjust in each | variables](vignettes/template-variables.md) that you can adjust in each | ||||
| of the themes\! | |||||
| of the themes! | |||||
| <img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example-rstudio-completion.gif" alt="Demonstration of argument auto-completion with RStudio" data-external="1" /> | <img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/example-rstudio-completion.gif" alt="Demonstration of argument auto-completion with RStudio" data-external="1" /> | ||||
| Presentation* from the New R Markdown Document menu in RStudio. | Presentation* from the New R Markdown Document menu in RStudio. | ||||
| <center> | <center> | ||||
| <img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/rmarkdown-template-screenshot.png" alt="The 'New R Markdown Document' menu in RStudio" data-external="1" /> | <img src="https://raw.githubusercontent.com/gadenbuie/xaringanthemer/assets/rmarkdown-template-screenshot.png" alt="The 'New R Markdown Document' menu in RStudio" data-external="1" /> | ||||
| </center> | </center> | ||||
| ## Features | ## Features | ||||
| There’s a lot more that **xaringanthemer** can do\! [Discover | |||||
| There’s a lot more that **xaringanthemer** can do! [Discover | |||||
| xaringanthemer’s | xaringanthemer’s | ||||
| features.](https://pkg.garrickadenbuie.com/xaringanthemer/articles/xaringanthemer.html) | features.](https://pkg.garrickadenbuie.com/xaringanthemer/articles/xaringanthemer.html) |
| **xaringanthemer** was built by [Garrick Aden-Buie](https://www.garrickadenbuie.com) ([@grrrck](https://twitter.com/grrrck)). | **xaringanthemer** was built by [Garrick Aden-Buie](https://www.garrickadenbuie.com) ([@grrrck](https://twitter.com/grrrck)). | ||||
| Big thank you to [Yihui Xie](https://yihui.org), especially for [xaringan]. | |||||
| Also thanks to [Ole Petter Bang](http://www.gnab.org/) for [remark.js][remarkjs]. | |||||
| Big thank you to [Yihui Xie](https://yihui.org/), especially for [xaringan]. | |||||
| Also thanks to [Ole Petter Bang](https://gnab.org/) for [remark.js][remarkjs]. | |||||
| Feel free to [file an issue](https://github.com/gadenbuie/xaringanthemer/issues) | |||||
| Feel free to [file an issue](https://github.com/gadenbuie/xaringanthemer/issues) | |||||
| if you find a bug or have a theme suggestion -- or better yet, submit a pull request! | if you find a bug or have a theme suggestion -- or better yet, submit a pull request! |
| # printing google_font works | |||||
| Code | |||||
| google_font("Josefin Sans", "400", "400i", "600i", "700") | |||||
| Output | |||||
| Family: Josefin Sans | |||||
| Weights: 400,400i,600i,700 | |||||
| URL: https://fonts.googleapis.com/css?family=Josefin+Sans:400,400i,600i,700&display=swap | |||||
| expect_equal(res$after_set$line_colour, "#0088ff") | expect_equal(res$after_set$line_colour, "#0088ff") | ||||
| expect_equal(res$after_set$bar_fill, "#FF8800") | expect_equal(res$after_set$bar_fill, "#FF8800") | ||||
| expect_equal(res$after_restore$line_colour, res$original$colour) | expect_equal(res$after_restore$line_colour, res$original$colour) | ||||
| expect_equal(res$after_restore$bar_fill, res$original$fil) | |||||
| expect_equal(res$after_restore$bar_fill, res$original$fill) | |||||
| }) | }) | ||||
| describe("theme_xaringan_get_value()", { | describe("theme_xaringan_get_value()", { |
| test_that("element_description", { | test_that("element_description", { | ||||
| text_in <- c("multiple", NA, "", ".remark-slide-content", "h1", "pre, code") | text_in <- c("multiple", NA, "", ".remark-slide-content", "h1", "pre, code") | ||||
| text_out <- c( | text_out <- c( |
| test_that("style_xaringan() writes to specified outfile", { | test_that("style_xaringan() writes to specified outfile", { | ||||
| tmpfile <- tempfile(fileext = ".css") | tmpfile <- tempfile(fileext = ".css") | ||||
| expect_equal(style_xaringan(outfile = tmpfile), tmpfile) | expect_equal(style_xaringan(outfile = tmpfile), tmpfile) |
| test_theme_file <- function(theme = "duo", theme_file = paste0(theme, ".css"), ...) { | test_theme_file <- function(theme = "duo", theme_file = paste0(theme, ".css"), ...) { | ||||
| local_edition(2) | local_edition(2) | ||||
| on.exit(local_edition(3)) | on.exit(local_edition(3)) |
| collapse = TRUE, | collapse = TRUE, | ||||
| warning = FALSE, | warning = FALSE, | ||||
| comment = "#>", | comment = "#>", | ||||
| fig.width = 6, | |||||
| fig.width = 6, | |||||
| fig.height = 4 | fig.height = 4 | ||||
| ) | ) | ||||
| ``` | ``` | ||||
| ```{r ggplot2-demo-1, out.width = "48%", fig.show="hide"} | ```{r ggplot2-demo-1, out.width = "48%", fig.show="hide"} | ||||
| library(ggplot2) | library(ggplot2) | ||||
| g_base <- ggplot(mpg) + | |||||
| aes(hwy, cty) + | |||||
| g_base <- ggplot(mpg) + | |||||
| aes(hwy, cty) + | |||||
| geom_point() + | geom_point() + | ||||
| labs(x = "Highway MPG", y = "City MPG", title = "Fuel Efficiency") | labs(x = "Highway MPG", y = "City MPG", title = "Fuel Efficiency") | ||||
| - `header_font_google = google_font("Oleo Script")`. | - `header_font_google = google_font("Oleo Script")`. | ||||
| ```{r text demo, fig.width = 10} | ```{r text demo, fig.width = 10} | ||||
| g_diamonds_with_text <- | |||||
| g_diamonds + | |||||
| g_diamonds_with_text <- | |||||
| g_diamonds + | |||||
| geom_text(aes(y = ..count.., label = format(..count.., big.mark = ",")), | geom_text(aes(y = ..count.., label = format(..count.., big.mark = ",")), | ||||
| vjust = -0.30, size = 8, stat = "count") + | |||||
| vjust = -0.30, size = 8, stat = "count") + | |||||
| labs(x = "Cut", y = "Count") | labs(x = "Cut", y = "Count") | ||||
| g_diamonds_with_text + theme_xaringan() | g_diamonds_with_text + theme_xaringan() | ||||
| ```{r eval=FALSE} | ```{r eval=FALSE} | ||||
| font_url <- file.path( | font_url <- file.path( | ||||
| "https://fontlibrary.org/assets/fonts/glacial-indifference/", | "https://fontlibrary.org/assets/fonts/glacial-indifference/", | ||||
| "5f2cf277506e19ec77729122f27b1faf/0820b3c58fed35de298219f314635982", | |||||
| "5f2cf277506e19ec77729122f27b1faf/0820b3c58fed35de298219f314635982", | |||||
| "GlacialIndifferenceRegular.ttf" | "GlacialIndifferenceRegular.ttf" | ||||
| ) | ) | ||||