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

450 lines
20KB

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