😎 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.

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