😎 Give your xaringan slides some style
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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