😎 Give your xaringan slides some style
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

470 lines
21KB

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/style_font_default.R, R/style_xaringan.R
  3. \name{xaringanthemer_font_default}
  4. \alias{xaringanthemer_font_default}
  5. \alias{style_xaringan}
  6. \title{Write A Customized Xaringan Theme}
  7. \usage{
  8. xaringanthemer_font_default(font_arg)
  9. style_xaringan(
  10. text_color = "#000",
  11. header_color = "#000",
  12. background_color = "#FFF",
  13. link_color = "rgb(249, 38, 114)",
  14. text_bold_color = NULL,
  15. text_slide_number_color = inverse_background_color,
  16. padding = "16px 64px 16px 64px",
  17. background_image = NULL,
  18. background_size = NULL,
  19. background_position = NULL,
  20. code_highlight_color = "rgba(255,255,0,0.5)",
  21. code_inline_color = "#000",
  22. code_inline_background_color = NULL,
  23. code_inline_font_size = "1em",
  24. inverse_background_color = "#272822",
  25. inverse_text_color = "#d6d6d6",
  26. inverse_text_shadow = FALSE,
  27. inverse_header_color = "#f3f3f3",
  28. inverse_link_color = link_color,
  29. title_slide_text_color = inverse_text_color,
  30. title_slide_background_color = inverse_background_color,
  31. title_slide_background_image = NULL,
  32. title_slide_background_size = NULL,
  33. title_slide_background_position = NULL,
  34. footnote_color = NULL,
  35. footnote_font_size = "0.9em",
  36. footnote_position_bottom = "60px",
  37. left_column_subtle_color = "#777",
  38. left_column_selected_color = "#000",
  39. blockquote_left_border_color = "lightgray",
  40. table_border_color = "#666",
  41. table_row_border_color = "#ddd",
  42. table_row_even_background_color = "#eee",
  43. base_font_size = "20px",
  44. text_font_size = "1rem",
  45. header_h1_font_size = "2.75rem",
  46. header_h2_font_size = "2.25rem",
  47. header_h3_font_size = "1.75rem",
  48. header_background_auto = FALSE,
  49. header_background_color = header_color,
  50. header_background_text_color = background_color,
  51. header_background_padding = NULL,
  52. header_background_content_padding_top = "7rem",
  53. header_background_ignore_classes = c("normal", "inverse", "title", "middle",
  54. "bottom"),
  55. text_slide_number_font_size = "0.9em",
  56. text_font_google = NULL,
  57. text_font_family = xaringanthemer_font_default("text_font_family"),
  58. text_font_weight = xaringanthemer_font_default("text_font_weight"),
  59. text_font_url = xaringanthemer_font_default("text_font_url"),
  60. text_font_family_fallback = xaringanthemer_font_default("text_font_family_fallback"),
  61. text_font_base = "sans-serif",
  62. header_font_google = NULL,
  63. header_font_family = xaringanthemer_font_default("header_font_family"),
  64. header_font_weight = xaringanthemer_font_default("header_font_weight"),
  65. header_font_family_fallback = "Georgia, serif",
  66. header_font_url = xaringanthemer_font_default("header_font_url"),
  67. code_font_google = NULL,
  68. code_font_family = xaringanthemer_font_default("code_font_family"),
  69. code_font_size = "0.9rem",
  70. code_font_url = xaringanthemer_font_default("code_font_url"),
  71. code_font_family_fallback = xaringanthemer_font_default("code_font_family_fallback"),
  72. colors = NULL,
  73. extra_css = NULL,
  74. extra_fonts = NULL,
  75. outfile = "xaringan-themer.css"
  76. )
  77. }
  78. \arguments{
  79. \item{font_arg}{A font argument from the \pkg{xaringanthemer} \code{style_}
  80. function family.}
  81. \item{text_color}{Text Color. Defaults to #000. Modifies the \code{body} element.
  82. The value of this variable is also stored as a CSS variable that can be
  83. referenced with \code{var(--text_color)} in any argument of a style function or
  84. in custom CSS.}
  85. \item{header_color}{Header Color. Defaults to #000. Modifies the
  86. \verb{h1, h2, h3} elements. The value of this variable is also stored as a CSS
  87. variable that can be referenced with \code{var(--header-color)} in any argument
  88. of a style function or in custom CSS.}
  89. \item{background_color}{Slide Background Color. Defaults to #FFF. Modifies
  90. the \code{.remark-slide-content} class. The value of this variable is also
  91. stored as a CSS variable that can be referenced with
  92. \code{var(--background-color)} in any argument of a style function or in custom
  93. CSS.}
  94. \item{link_color}{Link Color. Defaults to rgb(249, 38, 114). Modifies the
  95. \verb{a, a > code} elements. The value of this variable is also stored as a CSS
  96. variable that can be referenced with \code{var(--link-color)} in any argument
  97. of a style function or in custom CSS.}
  98. \item{text_bold_color}{Bold Text Color. Defaults to \code{NULL}. Modifies the
  99. \code{strong} element. The value of this variable is also stored as a CSS
  100. variable that can be referenced with \code{var(--text-bold-color)} in any
  101. argument of a style function or in custom CSS.}
  102. \item{text_slide_number_color}{Slide Number Color. Defaults to
  103. \code{inverse_background_color}. Modifies the \code{.remark-slide-number} class.}
  104. \item{padding}{Slide Padding in \verb{top right [bottom left]} format. Defaults
  105. to 16px 64px 16px 64px. Modifies the \code{.remark-slide-content} class.
  106. Accepts CSS
  107. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/padding}{padding}
  108. property values.}
  109. \item{background_image}{Background image applied to each \emph{and every} slide.
  110. Set \code{title_slide_background_image = "none"} to remove the background image
  111. from the title slide. Defaults to \code{NULL}. Modifies the
  112. \code{.remark-slide-content} class.}
  113. \item{background_size}{Background image size, requires \code{background_image} to
  114. be set. If \code{background_image} is set, \code{background_size} will default to
  115. \code{cover} so the background fills the screen. If both \code{background_image} and
  116. \code{background_position} are set, will default to 100 percent. Defaults to
  117. \code{NULL}. Modifies the \code{.remark-slide-content} class. Accepts CSS
  118. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-size}{background-size}
  119. property values.}
  120. \item{background_position}{Background image position, requires
  121. \code{background_image} to be set, and it is recommended to adjust
  122. \code{background_size}. Defaults to \code{NULL}. Modifies the
  123. \code{.remark-slide-content} class. Accepts CSS
  124. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}{background-position}
  125. property values.}
  126. \item{code_highlight_color}{Code Line Highlight. Defaults to
  127. rgba(255,255,0,0.5). Modifies the \code{.remark-code-line-highlighted} class.
  128. The value of this variable is also stored as a CSS variable that can be
  129. referenced with \code{var(--code-highlight-color)} in any argument of a style
  130. function or in custom CSS.}
  131. \item{code_inline_color}{Inline Code Color. Defaults to #000. Modifies the
  132. \code{.remark-inline-code} class.}
  133. \item{code_inline_background_color}{Inline Code Background Color. Defaults
  134. to \code{NULL}. Modifies the \code{.remark-inline-code} class.}
  135. \item{code_inline_font_size}{Inline Code Text Font Size. Defaults to 1em.
  136. Modifies the \code{.remark-inline-code} class. Accepts CSS
  137. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  138. property values. The value of this variable is also stored as a CSS
  139. variable that can be referenced with \code{var(--code-inline-font-size)} in any
  140. argument of a style function or in custom CSS.}
  141. \item{inverse_background_color}{Inverse Background Color. Defaults to
  142. #272822. Modifies the \code{.inverse} class. The value of this variable is also
  143. stored as a CSS variable that can be referenced with
  144. \code{var(--inverse-background-color)} in any argument of a style function or
  145. in custom CSS.}
  146. \item{inverse_text_color}{Inverse Text Color. Defaults to #d6d6d6. Modifies
  147. the \code{.inverse} class. The value of this variable is also stored as a CSS
  148. variable that can be referenced with \code{var(--inverse-text-color)} in any
  149. argument of a style function or in custom CSS.}
  150. \item{inverse_text_shadow}{Enables Shadow on text of inverse slides.
  151. Defaults to \code{FALSE}. Modifies the \code{.inverse} class.}
  152. \item{inverse_header_color}{Inverse Header Color. Defaults to #f3f3f3.
  153. Modifies the \verb{.inverse h1, .inverse h2, .inverse h3} classes. The value of
  154. this variable is also stored as a CSS variable that can be referenced with
  155. \code{var(--inverse-header-color)} in any argument of a style function or in
  156. custom CSS.}
  157. \item{inverse_link_color}{Inverse Link Color. Defaults to \code{link_color}.
  158. Modifies the \verb{.inverse a, .inverse a > code} classes. The value of this
  159. variable is also stored as a CSS variable that can be referenced with
  160. \code{var(--inverse-link-color)} in any argument of a style function or in
  161. custom CSS.}
  162. \item{title_slide_text_color}{Title Slide Text Color. Defaults to
  163. \code{inverse_text_color}. Modifies the \code{.title-slide} class. The value of this
  164. variable is also stored as a CSS variable that can be referenced with
  165. \code{var(--title-slide-text-color)} in any argument of a style function or in
  166. custom CSS.}
  167. \item{title_slide_background_color}{Title Slide Background Color. Defaults
  168. to \code{inverse_background_color}. Modifies the \code{.title-slide} class. The
  169. value of this variable is also stored as a CSS variable that can be
  170. referenced with \code{var(--title-slide-background-color)} in any argument of a
  171. style function or in custom CSS.}
  172. \item{title_slide_background_image}{Title Slide Background Image URL.
  173. Defaults to \code{NULL}. Modifies the \code{.title-slide} class.}
  174. \item{title_slide_background_size}{Title Slide Background Image Size,
  175. defaults to "cover" if background image is set. Defaults to \code{NULL}.
  176. Modifies the \code{.title-slide} class. Accepts CSS
  177. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-size}{background-size}
  178. property values.}
  179. \item{title_slide_background_position}{Title Slide Background Image
  180. Position. Defaults to \code{NULL}. Modifies the \code{.title-slide} class. Accepts
  181. CSS
  182. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}{background-position}
  183. property values.}
  184. \item{footnote_color}{Footnote text color (if \code{NA}, then it will be the same
  185. color as \code{text_color}). Defaults to \code{NULL}. Modifies the \code{.footnote}
  186. class.}
  187. \item{footnote_font_size}{Footnote font size. Defaults to 0.9em. Modifies
  188. the \code{.footnote} class. Accepts CSS
  189. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  190. property values.}
  191. \item{footnote_position_bottom}{Footnote location from bottom of screen.
  192. Defaults to 60px. Modifies the \code{.footnote} class. Accepts CSS
  193. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/position_value}{position}
  194. property values.}
  195. \item{left_column_subtle_color}{Left Column Text (not last). Defaults to
  196. #777. Modifies the \verb{.left-column h2, .left-column h3} classes.}
  197. \item{left_column_selected_color}{Left Column Current Selection. Defaults to
  198. #000. Modifies the
  199. \verb{.left-column h2:last-of-type, .left-column h3:last-child} classes.}
  200. \item{blockquote_left_border_color}{Blockquote Left Border Color. Defaults
  201. to lightgray. Modifies the \code{blockquote} element.}
  202. \item{table_border_color}{Table top/bottom border. Defaults to #666.
  203. Modifies the \verb{table: border-top, border-bottom} elements.}
  204. \item{table_row_border_color}{Table row inner bottom border. Defaults to
  205. #ddd. Modifies the \verb{table thead th: border-bottom} elements.}
  206. \item{table_row_even_background_color}{Table Even Row Background Color.
  207. Defaults to #eee. Modifies the \verb{thead, tfoot, tr:nth-child(even)}
  208. elements.}
  209. \item{base_font_size}{Base Font Size for All Slide Elements (must be \code{px}).
  210. Defaults to 20px. Modifies the \code{html} element. The value of this variable
  211. is also stored as a CSS variable that can be referenced with
  212. \code{var(--base-font-size)} in any argument of a style function or in custom
  213. CSS.}
  214. \item{text_font_size}{Slide Body Text Font Size. Defaults to 1rem. Modifies
  215. the \code{.remark-slide-content} class. Accepts CSS
  216. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  217. property values. The value of this variable is also stored as a CSS
  218. variable that can be referenced with \code{var(--text-font-size)} in any
  219. argument of a style function or in custom CSS.}
  220. \item{header_h1_font_size}{h1 Header Text Font Size. Defaults to 2.75rem.
  221. Modifies the \verb{.remark-slide-content h1} class. Accepts CSS
  222. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  223. property values. The value of this variable is also stored as a CSS
  224. variable that can be referenced with \code{var(--header-h1-font-size)} in any
  225. argument of a style function or in custom CSS.}
  226. \item{header_h2_font_size}{h2 Header Text Font Size. Defaults to 2.25rem.
  227. Modifies the \verb{.remark-slide-content h2} class. Accepts CSS
  228. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  229. property values. The value of this variable is also stored as a CSS
  230. variable that can be referenced with \code{var(--header-h2-font-size)} in any
  231. argument of a style function or in custom CSS.}
  232. \item{header_h3_font_size}{h3 Header Text Font Size. Defaults to 1.75rem.
  233. Modifies the \verb{.remark-slide-content h3} class. Accepts CSS
  234. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  235. property values. The value of this variable is also stored as a CSS
  236. variable that can be referenced with \code{var(--header-h3-font-size)} in any
  237. argument of a style function or in custom CSS.}
  238. \item{header_background_auto}{Add background under slide title automatically
  239. for h1 header elements. If not enabled, use \code{class: header_background} to
  240. enable. Defaults to \code{FALSE}.}
  241. \item{header_background_color}{Background Color for h1 Header with
  242. Background. Defaults to \code{header_color}. Modifies the
  243. \verb{.remark-slide-content h1} class. The value of this variable is also
  244. stored as a CSS variable that can be referenced with
  245. \code{var(--header-background-color)} in any argument of a style function or in
  246. custom CSS.}
  247. \item{header_background_text_color}{Text Color for h1 Header with
  248. Background. Defaults to \code{background_color}. Modifies the
  249. \verb{.remark-slide-content h1} class. The value of this variable is also
  250. stored as a CSS variable that can be referenced with
  251. \code{var(--header-background-text-color)} in any argument of a style function
  252. or in custom CSS.}
  253. \item{header_background_padding}{Padding for h1 Header with Background.
  254. Defaults to \code{NULL}. Modifies the \verb{.remark-slide-content h1} class. Accepts
  255. CSS \href{https://developer.mozilla.org/en-US/docs/Web/CSS/padding}{padding}
  256. property values.}
  257. \item{header_background_content_padding_top}{Top Padding for Content in
  258. Slide with Header with Background. Defaults to 7rem. Modifies the
  259. \code{.remark-slide-content} class.}
  260. \item{header_background_ignore_classes}{Slide Classes Where Header with
  261. Background will not be Applied. Defaults to
  262. \code{c('normal', 'inverse', 'title', 'middle', 'bottom')}. Modifies the
  263. \code{.remark-slide-content} class.}
  264. \item{text_slide_number_font_size}{Slide Number Text Font Size. Defaults to
  265. 0.9em. Modifies the \code{.remark-slide-number} class. Accepts CSS
  266. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  267. property values.}
  268. \item{text_font_google}{Use \code{google_font()} to specify body font. Defaults
  269. to \code{NULL}. Modifies the \code{body} element.}
  270. \item{text_font_family}{Body Text Font Family (xaringan default is
  271. \code{'Droid Serif'}). Defaults to
  272. \code{xaringanthemer_font_default("text_font_family")}. Modifies the \code{body}
  273. element. The value of this variable is also stored as a CSS variable that
  274. can be referenced with \code{var(--text-font-family)} in any argument of a
  275. style function or in custom CSS.}
  276. \item{text_font_weight}{Body Text Font Weight. Defaults to
  277. \code{xaringanthemer_font_default("text_font_weight")}. Modifies the \code{body}
  278. element. Accepts CSS
  279. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight}{font-weight}
  280. property values.}
  281. \item{text_font_url}{Body Text Font URL(s). Defaults to
  282. \code{xaringanthemer_font_default("text_font_url")}. Modifies the
  283. \verb{@import url()} elements.}
  284. \item{text_font_family_fallback}{Body Text Font Fallbacks. Defaults to
  285. \code{xaringanthemer_font_default("text_font_family_fallback")}. Modifies the
  286. \code{body} element. The value of this variable is also stored as a CSS
  287. variable that can be referenced with \code{var(--text-font-family-fallback)} in
  288. any argument of a style function or in custom CSS.}
  289. \item{text_font_base}{Body Text Base Font (Total Failure Fallback). Defaults
  290. to sans-serif. Modifies the \code{body} element. The value of this variable is
  291. also stored as a CSS variable that can be referenced with
  292. \code{var(--text-font-base)} in any argument of a style function or in custom
  293. CSS.}
  294. \item{header_font_google}{Use \code{google_font()} to specify header font.
  295. Defaults to \code{NULL}. Modifies the \code{body} element.}
  296. \item{header_font_family}{Header Font Family (xaringan default is
  297. \code{'Yanone Kaffeesatz'}). Defaults to
  298. \code{xaringanthemer_font_default("header_font_family")}. Modifies the
  299. \verb{h1, h2, h3} elements. The value of this variable is also stored as a CSS
  300. variable that can be referenced with \code{var(--header-font-family)} in any
  301. argument of a style function or in custom CSS.}
  302. \item{header_font_weight}{Header Font Weight. Defaults to
  303. \code{xaringanthemer_font_default("header_font_weight")}. Modifies the
  304. \verb{h1, h2, h3} elements. Accepts CSS
  305. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight}{font-weight}
  306. property values.}
  307. \item{header_font_family_fallback}{Header Font Family Fallback. Defaults to
  308. Georgia, serif. Modifies the \verb{h1, h2, h3} elements. The value of this
  309. variable is also stored as a CSS variable that can be referenced with
  310. \code{var(--header-font-family-fallback)} in any argument of a style function
  311. or in custom CSS.}
  312. \item{header_font_url}{Header Font URL. Defaults to
  313. \code{xaringanthemer_font_default("header_font_url")}. Modifies the
  314. \verb{@import url} elements.}
  315. \item{code_font_google}{Use \code{google_font()} to specify code font. Defaults
  316. to \code{NULL}. Modifies the \code{body} element.}
  317. \item{code_font_family}{Code Font Family. Defaults to
  318. \code{xaringanthemer_font_default("code_font_family")}. Modifies the
  319. \verb{.remark-code, .remark-inline-code} classes. The value of this variable is
  320. also stored as a CSS variable that can be referenced with
  321. \code{var(--code-font-family)} in any argument of a style function or in custom
  322. CSS.}
  323. \item{code_font_size}{Code Text Font Size. Defaults to 0.9rem. Modifies the
  324. \code{.remark-inline} class. Accepts CSS
  325. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  326. property values. The value of this variable is also stored as a CSS
  327. variable that can be referenced with \code{var(--code-font-size)} in any
  328. argument of a style function or in custom CSS.}
  329. \item{code_font_url}{Code Font URL. Defaults to
  330. \code{xaringanthemer_font_default("code_font_url")}. Modifies the \verb{@import url}
  331. elements.}
  332. \item{code_font_family_fallback}{Code Font Fallback. Defaults to
  333. \code{xaringanthemer_font_default("code_font_family_fallback")}. Modifies the
  334. \verb{.remark-code, .remark-inline-code} classes.}
  335. \item{colors}{A named vector of custom colors. The names of the colors
  336. become CSS variables and classes that can be used within your slides.
  337. For example, \code{colors = c(blue = "#bad4ed")} adds a CSS variable
  338. \code{--blue}, a \code{.blue} CSS class that applies the color to the text or
  339. foreground color, and a \code{.bg-blue} CSS class that applies the color
  340. to the background.}
  341. \item{extra_css}{A named list of CSS definitions each containing a named list
  342. of CSS property-value pairs, i.e.
  343. \code{list(".class-id" = list("css-property" = "value"))}.}
  344. \item{extra_fonts}{A list of additional fonts to import, each list element
  345. can be either a URL as a character string or a call to
  346. \code{\link{google_font}()}. To use a font imported in \code{extra_fonts}, you
  347. will need to write custom CSS rules that apply the font to an element or
  348. class with the \code{font-family} property. See the \strong{Fonts} section of
  349. \code{vignette("xaringanthemer")} for an example.}
  350. \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"}
  351. }
  352. \value{
  353. The CSS styles are written to the file path provided in \code{outfile}
  354. (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is
  355. returned directly as a character string.
  356. }
  357. \description{
  358. Creates a customized Xaringan theme CSS file.
  359. }
  360. \section{Functions}{
  361. \itemize{
  362. \item \code{xaringanthemer_font_default}: Default values for font family, weight, URLs and
  363. font fallbacks.
  364. }}
  365. \section{Usage}{
  366. To use the styles created by this theme function, make sure
  367. that you use \code{xaringan-themer.css} as your CSS file in your slides' YAML
  368. header. If you change the name of the output file using the \code{outfile}
  369. argument, use that name instead of the default file name.\if{html}{\out{<div class="yaml">}}\preformatted{output:
  370. xaringan::moon_reader:
  371. css: xaringan-themer.css
  372. }\if{html}{\out{</div>}}
  373. }
  374. \examples{
  375. # Create a xaringan style in a temporary file
  376. xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css")
  377. style_xaringan(
  378. text_color = "#002b3",
  379. inverse_background_color = "#31b09e",
  380. inverse_text_color = "#002b3",
  381. outfile = xaringan_themer_css # omit in your slides to write the
  382. # styles to xaringan-themer.css
  383. )
  384. # View the CSS:
  385. # file.edit(xaringan_themer_css)
  386. }
  387. \seealso{
  388. Other themes:
  389. \code{\link{style_duo_accent_inverse}()},
  390. \code{\link{style_duo_accent}()},
  391. \code{\link{style_duo}()},
  392. \code{\link{style_mono_accent_inverse}()},
  393. \code{\link{style_mono_accent}()},
  394. \code{\link{style_mono_dark}()},
  395. \code{\link{style_mono_light}()},
  396. \code{\link{style_solarized_dark}()},
  397. \code{\link{style_solarized_light}()}
  398. }
  399. \concept{themes}