| @@ -95,6 +95,7 @@ duo <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -99,6 +99,7 @@ duo_accent <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -99,6 +99,7 @@ duo_accent_inverse <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -97,6 +97,7 @@ mono_accent <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -97,6 +97,7 @@ mono_accent_inverse <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -97,6 +97,7 @@ mono_dark <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -97,6 +97,7 @@ mono_light <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -91,6 +91,7 @@ solarized_dark <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -91,6 +91,7 @@ solarized_light <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R | |||
| @@ -63,3 +63,14 @@ list2css <- function(css) { | |||
| ) | |||
| }) | |||
| } | |||
| list2fonts <- function(fonts) { | |||
| fonts <- purrr::map_chr(fonts, function(f) { | |||
| if (inherits(f, "google_font")) { | |||
| f$url | |||
| } else if (inherits(f, "character")) { | |||
| f | |||
| } else NA_character_ | |||
| }) | |||
| paste0("@import url(", fonts[!is.na(fonts)], ");") | |||
| } | |||
| @@ -90,6 +90,7 @@ write_xaringan_theme <- function( | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", | |||
| extra_css = NULL, | |||
| extra_fonts = NULL, | |||
| outfile = "xaringan-themer.css" | |||
| ) { | |||
| # Make sure font names are wrapped in quotes if they have spaces | |||
| @@ -122,6 +123,8 @@ write_xaringan_theme <- function( | |||
| } | |||
| } | |||
| extra_font_imports <- if (is.null(extra_fonts)) "" else list2fonts(extra_fonts) | |||
| tf <- system.file("resources", "template.css", package = "xaringanthemer") | |||
| template <- readLines(tf, warn = FALSE) | |||
| template <- paste(template, collapse = "\n") | |||
| @@ -257,6 +257,15 @@ solarized_dark( | |||
| ) | |||
| ``` | |||
| If you need to import additional fonts for use in [custom CSS definitions](#adding-custom-css), you can use the `extra_fonts` argument to pass a list of URLs or `google_font()`s. | |||
| ```r | |||
| mono_light( | |||
| extra_fonts = list(google_font("Sofia")), | |||
| extra_css = list(".title-slide h2" = list("font-family" = "Sofia")) | |||
| ) | |||
| ``` | |||
| *** | |||
| **xaringanthemer** was built by [Garrick Aden-Buie](https://www.garrickadenbuie.com) ([@grrrck](https://twitter.com/grrrck)). | |||
| @@ -170,7 +170,7 @@ Here are some of the `text_` theme options: | |||
| - `text_bold_color` | |||
| - `text_slide_number_color` | |||
| - `text_size` | |||
| - `text_size_h1` | |||
| - `text_slide_number_font_size` | |||
| - *and more …* | |||
| And here are the title slide theme options: | |||
| @@ -264,6 +264,17 @@ solarized_dark( | |||
| ) | |||
| ``` | |||
| If you need to import additional fonts for use in [custom CSS | |||
| definitions](#adding-custom-css), you can use the `extra_fonts` argument | |||
| to pass a list of URLs or `google_font()`s. | |||
| ``` r | |||
| mono_light( | |||
| extra_fonts = list(google_font("Sofia")), | |||
| extra_css = list(".title-slide h2" = list("font-family" = "Sofia")) | |||
| ) | |||
| ``` | |||
| ----- | |||
| **xaringanthemer** was built by [Garrick | |||
| @@ -1,6 +1,7 @@ | |||
| @import url({{text_font_url}}); | |||
| @import url({{header_font_url}}); | |||
| @import url({{code_font_url}}); | |||
| {{extra_font_imports}} | |||
| body { | |||
| font-family: {{paste(text_font_family, text_font_family_fallback, text_font_base, sep = ", ")}}; | |||
| @@ -23,6 +23,7 @@ setup_theme_function <- function( | |||
| as.character(glue::glue_data( | |||
| tv, " {variable} = {ifelse(!stringr::str_detect(default, '^[{].+[}]$'), paste0('\"', default, '\"'), stringr::str_replace_all(default, '[{}]', ''))},")) %,% | |||
| " extra_css = NULL," %,% | |||
| " extra_fonts = NULL," %,% | |||
| " outfile = \"xaringan-themer.css\"" %,% | |||
| ") {" | |||
| if (!is.null(body)) x <- c(x, body, "}") | |||
| @@ -28,6 +28,8 @@ for (var in f_args[grepl("font_google$", f_args)]) { | |||
| } | |||
| } | |||
| extra_font_imports <- if (is.null(extra_fonts)) "" else list2fonts(extra_fonts) | |||
| tf <- system.file("resources", "template.css", package = "xaringanthemer") | |||
| template <- readLines(tf, warn = FALSE) | |||
| template <- paste(template, collapse = "\n") | |||
| @@ -1,3 +1,6 @@ | |||
| #' @param extra_css A named list of CSS definitions each containing a named list | |||
| #' of CSS property-value pairs, i.e. | |||
| #' \code{list(".class-id" = list("css-property" = "value"))} | |||
| #' @param extra_fonts A list of additional fonts to import, each list element | |||
| #' can be either a URL as a character string or a call to | |||
| #' \code{\link{google_fonts}()} | |||
| @@ -35,7 +35,7 @@ duo(primary_color = "#1F4257", secondary_color = "#F97B64", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{primary_color}{Duotone Primary Color, defaults to #1F4257} | |||
| @@ -132,6 +132,10 @@ duo(primary_color = "#1F4257", secondary_color = "#F97B64", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -39,7 +39,7 @@ duo_accent(primary_color = "#006747", secondary_color = "#CFC493", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{primary_color}{Duotone Primary Color, defaults to #006747} | |||
| @@ -140,6 +140,10 @@ duo_accent(primary_color = "#006747", secondary_color = "#CFC493", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -40,7 +40,7 @@ duo_accent_inverse(primary_color = "#006747", secondary_color = "#CFC493", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{primary_color}{Duotone Primary Color, defaults to #006747} | |||
| @@ -141,6 +141,10 @@ duo_accent_inverse(primary_color = "#006747", secondary_color = "#CFC493", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -34,7 +34,7 @@ mono_accent(base_color = "#43418A", white_color = "#FFFFFF", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{base_color}{Monotone Base Color, works best with a strong color., defaults to #43418A} | |||
| @@ -133,6 +133,10 @@ mono_accent(base_color = "#43418A", white_color = "#FFFFFF", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -34,7 +34,7 @@ mono_accent_inverse(base_color = "#3C989E", white_color = "#FFFFFF", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{base_color}{Monotone Base Color, works best with a light color., defaults to #3C989E} | |||
| @@ -133,6 +133,10 @@ mono_accent_inverse(base_color = "#3C989E", white_color = "#FFFFFF", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -34,7 +34,7 @@ mono_dark(base_color = "#cbf7ed", white_color = lighten_color(base_color, | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{base_color}{Monotone Base Color, works best with a light color., defaults to #cbf7ed} | |||
| @@ -133,6 +133,10 @@ mono_dark(base_color = "#cbf7ed", white_color = lighten_color(base_color, | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -34,7 +34,7 @@ mono_light(base_color = "#23395b", white_color = lighten_color(base_color, | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{base_color}{Monotone base color, works best with a strong color, defaults to #23395b} | |||
| @@ -133,6 +133,10 @@ mono_light(base_color = "#23395b", white_color = lighten_color(base_color, | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -30,7 +30,7 @@ solarized_dark(text_color = "#839496", header_color = "#dc322f", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{text_color}{Text Color, defaults to #839496} | |||
| @@ -123,6 +123,10 @@ solarized_dark(text_color = "#839496", header_color = "#dc322f", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -30,7 +30,7 @@ solarized_light(text_color = "#657b83", header_color = "#dc322f", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{text_color}{Text Color, defaults to #657b83} | |||
| @@ -123,6 +123,10 @@ solarized_light(text_color = "#657b83", header_color = "#dc322f", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||
| @@ -30,7 +30,7 @@ write_xaringan_theme(text_color = "#000", header_color = "#000", | |||
| code_font_google = NULL, code_font_family = "'Source Code Pro'", | |||
| code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", | |||
| code_font_family_fallback = "'Lucida Console', Monaco", extra_css = NULL, | |||
| outfile = "xaringan-themer.css") | |||
| extra_fonts = NULL, outfile = "xaringan-themer.css") | |||
| } | |||
| \arguments{ | |||
| \item{text_color}{Text Color, defaults to #000} | |||
| @@ -123,6 +123,10 @@ write_xaringan_theme(text_color = "#000", header_color = "#000", | |||
| of CSS property-value pairs, i.e. | |||
| \code{list(".class-id" = list("css-property" = "value"))}} | |||
| \item{extra_fonts}{A list of additional fonts to import, each list element | |||
| can be either a URL as a character string or a call to | |||
| \code{\link{google_fonts}()}} | |||
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | |||
| } | |||
| \description{ | |||