😎 Give your xaringan slides some style
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

451 lines
23KB

  1. # Generated by inst/scripts/generate_theme_functions.R: do not edit by hand
  2. #' @param text_color Text Color. Defaults to #000. Modifies the `body` element.
  3. #' The value of this variable is also stored as a CSS variable that can be
  4. #' referenced with `var(--text_color)` in any argument of a style function or
  5. #' in custom CSS.
  6. #' @param header_color Header Color. Defaults to #000. Modifies the
  7. #' `h1, h2, h3` elements. The value of this variable is also stored as a CSS
  8. #' variable that can be referenced with `var(--header-color)` in any argument
  9. #' of a style function or in custom CSS.
  10. #' @param background_color Slide Background Color. Defaults to #FFF. Modifies
  11. #' the `.remark-slide-content` class. The value of this variable is also
  12. #' stored as a CSS variable that can be referenced with
  13. #' `var(--background-color)` in any argument of a style function or in custom
  14. #' CSS.
  15. #' @param link_color Link Color. Defaults to rgb(249, 38, 114). Modifies the
  16. #' `a, a > code` elements. The value of this variable is also stored as a CSS
  17. #' variable that can be referenced with `var(--link-color)` in any argument
  18. #' of a style function or in custom CSS.
  19. #' @param text_bold_color Bold Text Color. Defaults to `NULL`. Modifies the
  20. #' `strong` element. The value of this variable is also stored as a CSS
  21. #' variable that can be referenced with `var(--text-bold-color)` in any
  22. #' argument of a style function or in custom CSS.
  23. #' @param text_slide_number_color Slide Number Color. Defaults to
  24. #' `inverse_background_color`. Modifies the `.remark-slide-number` class.
  25. #' @param padding Slide Padding in `top right [bottom left]` format. Defaults
  26. #' to 16px 64px 16px 64px. Modifies the `.remark-slide-content` class.
  27. #' Accepts CSS
  28. #' [padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
  29. #' property values.
  30. #' @param background_image Background image applied to each *and every* slide.
  31. #' Set `title_slide_background_image = "none"` to remove the background image
  32. #' from the title slide. Defaults to `NULL`. Modifies the
  33. #' `.remark-slide-content` class.
  34. #' @param background_size Background image size, requires `background_image` to
  35. #' be set. If `background_image` is set, `background_size` will default to
  36. #' `cover` so the backround fills the screen. If both `background_image` and
  37. #' `background_position` are set, will default to 100 percent. Defaults to
  38. #' `NULL`. Modifies the `.remark-slide-content` class. Accepts CSS
  39. #' [background-size](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size)
  40. #' property values.
  41. #' @param background_position Background image position, requires
  42. #' `background_image` to be set, and it is recommended to adjust
  43. #' `background_size`. Defaults to `NULL`. Modifies the
  44. #' `.remark-slide-content` class. Accepts CSS
  45. #' [background-position](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position)
  46. #' property values.
  47. #' @param code_highlight_color Code Line Highlight. Defaults to
  48. #' rgba(255,255,0,0.5). Modifies the `.remark-code-line-highlighted` class.
  49. #' The value of this variable is also stored as a CSS variable that can be
  50. #' referenced with `var(--code-highlight-color)` in any argument of a style
  51. #' function or in custom CSS.
  52. #' @param code_inline_color Inline Code Color. Defaults to #000. Modifies the
  53. #' `.remark-inline-code` class.
  54. #' @param code_inline_background_color Inline Code Background Color. Defaults
  55. #' to `NULL`. Modifies the `.remark-inline-code` class.
  56. #' @param code_inline_font_size Inline Code Text Font Size. Defaults to 1em.
  57. #' Modifies the `.remark-inline-code` class. Accepts CSS
  58. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  59. #' property values. The value of this variable is also stored as a CSS
  60. #' variable that can be referenced with `var(--code-inline-font-size)` in any
  61. #' argument of a style function or in custom CSS.
  62. #' @param inverse_background_color Inverse Background Color. Defaults to
  63. #' #272822. Modifies the `.inverse` class. The value of this variable is also
  64. #' stored as a CSS variable that can be referenced with
  65. #' `var(--inverse-background-color)` in any argument of a style function or
  66. #' in custom CSS.
  67. #' @param inverse_text_color Inverse Text Color. Defaults to #d6d6d6. Modifies
  68. #' the `.inverse` class. The value of this variable is also stored as a CSS
  69. #' variable that can be referenced with `var(--inverse-text-color)` in any
  70. #' argument of a style function or in custom CSS.
  71. #' @param inverse_text_shadow Enables Shadow on text of inverse slides.
  72. #' Defaults to `FALSE`. Modifies the `.inverse` class.
  73. #' @param inverse_header_color Inverse Header Color. Defaults to #f3f3f3.
  74. #' Modifies the `.inverse h1, .inverse h2, .inverse h3` classes. The value of
  75. #' this variable is also stored as a CSS variable that can be referenced with
  76. #' `var(--inverse-header-color)` in any argument of a style function or in
  77. #' custom CSS.
  78. #' @param title_slide_text_color Title Slide Text Color. Defaults to
  79. #' `inverse_text_color`. Modifies the `.title-slide` class. The value of this
  80. #' variable is also stored as a CSS variable that can be referenced with
  81. #' `var(--title-slide-text-color)` in any argument of a style function or in
  82. #' custom CSS.
  83. #' @param title_slide_background_color Title Slide Background Color. Defaults
  84. #' to `inverse_background_color`. Modifies the `.title-slide` class. The
  85. #' value of this variable is also stored as a CSS variable that can be
  86. #' referenced with `var(--title-slide-background-color)` in any argument of a
  87. #' style function or in custom CSS.
  88. #' @param title_slide_background_image Title Slide Background Image URL.
  89. #' Defaults to `NULL`. Modifies the `.title-slide` class.
  90. #' @param title_slide_background_size Title Slide Background Image Size,
  91. #' defaults to "cover" if background image is set. Defaults to `NULL`.
  92. #' Modifies the `.title-slide` class. Accepts CSS
  93. #' [background-size](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size)
  94. #' property values.
  95. #' @param title_slide_background_position Title Slide Background Image
  96. #' Position. Defaults to `NULL`. Modifies the `.title-slide` class. Accepts
  97. #' CSS
  98. #' [background-position](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position)
  99. #' property values.
  100. #' @param footnote_color Footnote text color (if `NA`, then it will be the same
  101. #' color as `text_color`). Defaults to `NULL`. Modifies the `.footnote`
  102. #' class.
  103. #' @param footnote_font_size Footnote font size. Defaults to 0.9em. Modifies
  104. #' the `.footnote` class. Accepts CSS
  105. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  106. #' property values.
  107. #' @param footnote_position_bottom Footnote location from bottom of screen.
  108. #' Defaults to 60px. Modifies the `.footnote` class. Accepts CSS
  109. #' [position](https://developer.mozilla.org/en-US/docs/Web/CSS/position_value)
  110. #' property values.
  111. #' @param left_column_subtle_color Left Column Text (not last). Defaults to
  112. #' #777. Modifies the `.left-column h2, .left-column h3` classes.
  113. #' @param left_column_selected_color Left Column Current Selection. Defaults to
  114. #' #000. Modifies the
  115. #' `.left-column h2:last-of-type, .left-column h3:last-child` classes.
  116. #' @param blockquote_left_border_color Blockquote Left Border Color. Defaults
  117. #' to lightgray. Modifies the `blockquote` element.
  118. #' @param table_border_color Table top/bottom border. Defaults to #666.
  119. #' Modifies the `table: border-top, border-bottom` elements.
  120. #' @param table_row_border_color Table row inner bottom border. Defaults to
  121. #' #ddd. Modifies the `table thead th: border-bottom` elements.
  122. #' @param table_row_even_background_color Table Even Row Background Color.
  123. #' Defaults to #eee. Modifies the `thead, tfoot, tr:nth-child(even)`
  124. #' elements.
  125. #' @param base_font_size Base Font Size for All Slide Elements (must be `px`).
  126. #' Defaults to 20px. Modifies the `html` element. The value of this variable
  127. #' is also stored as a CSS variable that can be referenced with
  128. #' `var(--base-font-size)` in any argument of a style function or in custom
  129. #' CSS.
  130. #' @param text_font_size Slide Body Text Font Size. Defaults to 1rem. Modifies
  131. #' the `.remark-slide-content` class. Accepts CSS
  132. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  133. #' property values. The value of this variable is also stored as a CSS
  134. #' variable that can be referenced with `var(--text-font-size)` in any
  135. #' argument of a style function or in custom CSS.
  136. #' @param header_h1_font_size h1 Header Text Font Size. Defaults to 2.75rem.
  137. #' Modifies the `.remark-slide-content h1` class. Accepts CSS
  138. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  139. #' property values. The value of this variable is also stored as a CSS
  140. #' variable that can be referenced with `var(--header-h1-font-size)` in any
  141. #' argument of a style function or in custom CSS.
  142. #' @param header_h2_font_size h2 Header Text Font Size. Defaults to 2.25rem.
  143. #' Modifies the `.remark-slide-content h2` class. Accepts CSS
  144. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  145. #' property values. The value of this variable is also stored as a CSS
  146. #' variable that can be referenced with `var(--header-h2-font-size)` in any
  147. #' argument of a style function or in custom CSS.
  148. #' @param header_h3_font_size h3 Header Text Font Size. Defaults to 1.75rem.
  149. #' Modifies the `.remark-slide-content h3` class. Accepts CSS
  150. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  151. #' property values. The value of this variable is also stored as a CSS
  152. #' variable that can be referenced with `var(--header-h3-font-size)` in any
  153. #' argument of a style function or in custom CSS.
  154. #' @param header_background_auto Add background under slide title automatically
  155. #' for h1 header elements. If not enabled, use `class: header_background` to
  156. #' enable. Defaults to `FALSE`.
  157. #' @param header_background_color Background Color for h1 Header with
  158. #' Background. Defaults to `header_color`. Modifies the
  159. #' `.remark-slide-content h1` class. The value of this variable is also
  160. #' stored as a CSS variable that can be referenced with
  161. #' `var(--header-background-color)` in any argument of a style function or in
  162. #' custom CSS.
  163. #' @param header_background_text_color Text Color for h1 Header with
  164. #' Background. Defaults to `background_color`. Modifies the
  165. #' `.remark-slide-content h1` class. The value of this variable is also
  166. #' stored as a CSS variable that can be referenced with
  167. #' `var(--header-background-text-color)` in any argument of a style function
  168. #' or in custom CSS.
  169. #' @param header_background_padding Padding for h1 Header with Background.
  170. #' Defaults to `NULL`. Modifies the `.remark-slide-content h1` class. Accepts
  171. #' CSS [padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
  172. #' property values.
  173. #' @param header_background_content_padding_top Top Padding for Content in
  174. #' Slide with Header with Background. Defaults to 7rem. Modifies the
  175. #' `.remark-slide-content` class.
  176. #' @param header_background_ignore_classes Slide Classes Where Header with
  177. #' Background will not be Applied. Defaults to
  178. #' `c('normal', 'inverse', 'title', 'middle', 'bottom')`. Modifies the
  179. #' `.remark-slide-content` class.
  180. #' @param text_slide_number_font_size Slide Number Text Font Size. Defaults to
  181. #' 0.9em. Modifies the `.remark-slide-number` class. Accepts CSS
  182. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  183. #' property values.
  184. #' @param text_font_google Use `google_font()` to specify body font. Defaults
  185. #' to `NULL`. Modifies the `body` element.
  186. #' @param text_font_family Body Text Font Family (xaringan default is
  187. #' `'Droid Serif'`). Defaults to Noto Sans. Modifies the `body` element. The
  188. #' value of this variable is also stored as a CSS variable that can be
  189. #' referenced with `var(--text-font-family)` in any argument of a style
  190. #' function or in custom CSS.
  191. #' @param text_font_weight Body Text Font Weight. Defaults to normal. Modifies
  192. #' the `body` element. Accepts CSS
  193. #' [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight)
  194. #' property values.
  195. #' @param text_font_url Body Text Font URL(s). Defaults to
  196. #' https://fonts.googleapis.com/css?family=Noto+Sans:400,400i,700,700i&display=swap.
  197. #' Modifies the `@import url()` elements.
  198. #' @param text_font_family_fallback Body Text Font Fallbacks. Defaults to
  199. #' -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue,
  200. #' helvetica, Ubuntu, roboto, noto, segoe ui, arial. Modifies the `body`
  201. #' element. The value of this variable is also stored as a CSS variable that
  202. #' can be referenced with `var(--text-font-family-fallback)` in any argument
  203. #' of a style function or in custom CSS.
  204. #' @param text_font_base Body Text Base Font (Total Failure Fallback). Defaults
  205. #' to sans-serif. Modifies the `body` element. The value of this variable is
  206. #' also stored as a CSS variable that can be referenced with
  207. #' `var(--text-font-base)` in any argument of a style function or in custom
  208. #' CSS.
  209. #' @param header_font_google Use `google_font()` to specify header font.
  210. #' Defaults to `NULL`. Modifies the `body` element.
  211. #' @param header_font_family Header Font Family (xaringan default is
  212. #' `'Yanone Kaffeesatz'`). Defaults to Cabin. Modifies the `h1, h2, h3`
  213. #' elements. The value of this variable is also stored as a CSS variable that
  214. #' can be referenced with `var(--header-font-family)` in any argument of a
  215. #' style function or in custom CSS.
  216. #' @param header_font_weight Header Font Weight. Defaults to 600. Modifies the
  217. #' `h1, h2, h3` elements. Accepts CSS
  218. #' [font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight)
  219. #' property values.
  220. #' @param header_font_url Header Font URL. Defaults to
  221. #' https://fonts.googleapis.com/css?family=Cabin:600,600i&display=swap.
  222. #' Modifies the `@import url` elements.
  223. #' @param code_font_google Use `google_font()` to specify code font. Defaults
  224. #' to `NULL`. Modifies the `body` element.
  225. #' @param code_font_family Code Font Family. Defaults to Source Code Pro.
  226. #' Modifies the `.remark-code, .remark-inline-code` classes. The value of
  227. #' this variable is also stored as a CSS variable that can be referenced with
  228. #' `var(--code-font-family)` in any argument of a style function or in custom
  229. #' CSS.
  230. #' @param code_font_size Code Text Font Size. Defaults to 0.9rem. Modifies the
  231. #' `.remark-inline` class. Accepts CSS
  232. #' [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
  233. #' property values. The value of this variable is also stored as a CSS
  234. #' variable that can be referenced with `var(--code-font-size)` in any
  235. #' argument of a style function or in custom CSS.
  236. #' @param code_font_url Code Font URL. Defaults to
  237. #' https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700&display=swap.
  238. #' Modifies the `@import url` elements.
  239. #' @param code_font_family_fallback Code Font Fallback. Defaults to Menlo,
  240. #' Consolas, Monaco, Liberation Mono, Lucida Console. Modifies the
  241. #' `.remark-code, .remark-inline-code` classes.
  242. #' @template theme_params
  243. #' @template style-usage
  244. #' @template style_xaringan
  245. #' @export
  246. style_xaringan <- function(
  247. text_color = "#000",
  248. header_color = "#000",
  249. background_color = "#FFF",
  250. link_color = "rgb(249, 38, 114)",
  251. text_bold_color = NULL,
  252. text_slide_number_color = inverse_background_color,
  253. padding = "16px 64px 16px 64px",
  254. background_image = NULL,
  255. background_size = NULL,
  256. background_position = NULL,
  257. code_highlight_color = "rgba(255,255,0,0.5)",
  258. code_inline_color = "#000",
  259. code_inline_background_color = NULL,
  260. code_inline_font_size = "1em",
  261. inverse_background_color = "#272822",
  262. inverse_text_color = "#d6d6d6",
  263. inverse_text_shadow = FALSE,
  264. inverse_header_color = "#f3f3f3",
  265. title_slide_text_color = inverse_text_color,
  266. title_slide_background_color = inverse_background_color,
  267. title_slide_background_image = NULL,
  268. title_slide_background_size = NULL,
  269. title_slide_background_position = NULL,
  270. footnote_color = NULL,
  271. footnote_font_size = "0.9em",
  272. footnote_position_bottom = "60px",
  273. left_column_subtle_color = "#777",
  274. left_column_selected_color = "#000",
  275. blockquote_left_border_color = "lightgray",
  276. table_border_color = "#666",
  277. table_row_border_color = "#ddd",
  278. table_row_even_background_color = "#eee",
  279. base_font_size = "20px",
  280. text_font_size = "1rem",
  281. header_h1_font_size = "2.75rem",
  282. header_h2_font_size = "2.25rem",
  283. header_h3_font_size = "1.75rem",
  284. header_background_auto = FALSE,
  285. header_background_color = header_color,
  286. header_background_text_color = background_color,
  287. header_background_padding = NULL,
  288. header_background_content_padding_top = "7rem",
  289. header_background_ignore_classes = c('normal', 'inverse', 'title', 'middle', 'bottom'),
  290. text_slide_number_font_size = "0.9em",
  291. text_font_google = NULL,
  292. text_font_family = "Noto Sans",
  293. text_font_weight = "normal",
  294. text_font_url = "https://fonts.googleapis.com/css?family=Noto+Sans:400,400i,700,700i&display=swap",
  295. text_font_family_fallback = "-apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, Ubuntu, roboto, noto, segoe ui, arial",
  296. text_font_base = "sans-serif",
  297. header_font_google = NULL,
  298. header_font_family = "Cabin",
  299. header_font_weight = "600",
  300. header_font_url = "https://fonts.googleapis.com/css?family=Cabin:600,600i&display=swap",
  301. code_font_google = NULL,
  302. code_font_family = "Source Code Pro",
  303. code_font_size = "0.9rem",
  304. code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700&display=swap",
  305. code_font_family_fallback = "Menlo, Consolas, Monaco, Liberation Mono, Lucida Console",
  306. colors = NULL,
  307. extra_css = NULL,
  308. extra_fonts = NULL,
  309. outfile = "xaringan-themer.css"
  310. ) {
  311. # DO NOT EDIT - Generated from inst/scripts/generate_theme_functions.R
  312. # Make sure font names are wrapped in quotes if they have spaces
  313. f_args <- names(formals(sys.function()))
  314. for (var in f_args[grepl("font_family$", f_args)]) {
  315. var_value <- get(var, inherits = FALSE)
  316. if (!is.null(var_value)) {
  317. eval(parse(text = paste0(var, "<-quote_elements_w_spaces(", var, ")")))
  318. }
  319. # set an is_google flag default of FALSE that is possibly overwritten later
  320. eval(parse(text = paste0(sub("font_family$", "font_is_google", var), "<-0")))
  321. }
  322. # Warn if base_font_size isn't absolute
  323. css_abs_units <- c("cm", "mm", "Q", "in", "pc", "pt", "px")
  324. if (!grepl(paste(tolower(css_abs_units), collapse = "|"), tolower(base_font_size))) {
  325. warning(
  326. glue::glue(
  327. "Base font size '{base_font_size}' is not in absolute units. ",
  328. "For best results, specify the `base_font_size` using absolute CSS units: ",
  329. "{paste(css_abs_units, collapse = ', ')}"
  330. ),
  331. call. = FALSE,
  332. immediate. = TRUE
  333. )
  334. }
  335. # Use font_..._google args to overwrite font args
  336. for (var in f_args[grepl("font_google$", f_args)]) {
  337. gf <- eval(parse(text = var))
  338. if (is.null(gf)) next
  339. if (!inherits(gf, "google_font")) {
  340. stop("`", var, "` must be set using `google_font()`.")
  341. }
  342. group <- strsplit(var, "_")[[1]][1]
  343. if (group == "text") {
  344. text_font_family <- quote_elements_w_spaces(gf$family)
  345. text_font_weight <- gf$weights %||% "normal"
  346. text_font_weight <- substr(text_font_weight, 1, regexpr(",", text_font_weight)[1] - 1)
  347. text_font_url <- gf$url
  348. } else {
  349. eval(parse(text = paste0(group, "_font_family <- quote_elements_w_spaces(gf$family)")))
  350. eval(parse(text = paste0(group, "_font_url <- gf$url")))
  351. }
  352. eval(parse(text = paste0(group, "_font_is_google <- 1")))
  353. }
  354. is_default <- function(type, suffix, reference = style_xaringan) {
  355. var <- paste0(type, "_", suffix)
  356. default_value <- formals(reference)[[var]]
  357. if (suffix == "font_family") {
  358. default_value <- quote_elements_w_spaces(default_value)
  359. }
  360. get(var, envir = parent.frame(2), inherits = FALSE) == default_value
  361. }
  362. # the defaults are google fonts
  363. for (var in c("text", "header", "code")) {
  364. suffixes <- c("font_family", "font_weight", "font_url")
  365. if (var == "code") suffixes <- setdiff(suffixes, "font_weight")
  366. var_is_google <- all(vapply(suffixes, is_default, logical(1), type = var))
  367. if (var_is_google) {
  368. eval(parse(text = paste0(var, "_font_is_google <- 1")))
  369. }
  370. }
  371. extra_font_imports <- if (is.null(extra_fonts)) "" else list2fonts(extra_fonts)
  372. extra_font_imports <- paste(extra_font_imports, collapse = "\n")
  373. # convert NA arguments to NULL
  374. for (var in f_args) {
  375. val <- eval(parse(text = var))
  376. if (is.null(val)) next
  377. val <- val[!is.na(val)]
  378. is_na <- length(val) == 0
  379. if (is_na) assign(var, NULL)
  380. }
  381. # prepare variables for template
  382. body_font_family <- paste(c(text_font_family, text_font_family_fallback, text_font_base), collapse = ", ")
  383. background_size_fallback <- if (is.null(background_position)) "cover" else "100%"
  384. background_size <- background_image %??% (background_size %||% background_size_fallback)
  385. title_slide_background_size <- title_slide_background_size %||% (
  386. title_slide_background_image %??% "cover"
  387. )
  388. table_row_even_background_color <- table_row_even_background_color %||% background_color
  389. # stash theme settings in package env
  390. lapply(f_args, function(n) assign(n, get(n), envir = xaringanthemer_env))
  391. for (font_is_google in paste0(c("text", "code", "header"), "_font_is_google")) {
  392. assign(
  393. font_is_google,
  394. get(font_is_google, inherits = FALSE) == 1,
  395. envir = xaringanthemer_env
  396. )
  397. }
  398. xaringanthemer_version <- utils::packageVersion("xaringanthemer")
  399. # prepare header background object
  400. needs_leading_dot <- !grepl("^\\.", header_background_ignore_classes)
  401. header_background_ignore_classes[needs_leading_dot] <- paste0(
  402. ".",
  403. header_background_ignore_classes[needs_leading_dot]
  404. )
  405. header_background_ignore_classes <- purrr::map(
  406. header_background_ignore_classes,
  407. ~ list(class = .)
  408. )
  409. if (is.null(header_background_padding)) {
  410. slide_padding <- css_get_padding(padding)
  411. header_background_padding <- paste(
  412. "2rem", slide_padding$right, "1.5rem", slide_padding$left
  413. )
  414. }
  415. header_background <- list(
  416. auto = header_background_auto,
  417. background_color = header_background_color,
  418. text_color = header_background_text_color,
  419. padding = header_background_padding,
  420. content_padding_top = header_background_content_padding_top,
  421. ignore = header_background_ignore_classes
  422. )
  423. colors <- prepare_colors(colors)
  424. tf <- system.file("resources", "template.css", package = "xaringanthemer")
  425. template <- readLines(tf, warn = FALSE)
  426. template <- paste(template, collapse = "\n")
  427. x <- whisker::whisker.render(template)
  428. if (!is.null(extra_css)) {
  429. x <- c(x, style_extra_css(extra_css, outfile = NULL))
  430. }
  431. if (is.null(outfile)) {
  432. return(x)
  433. }
  434. writeLines(x, con = outfile)
  435. invisible(outfile)
  436. }