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

481 lines
22KB

  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", "bottom"),
  54. text_slide_number_font_size = "0.9rem",
  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_bold_font_weight = "bold",
  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. link_decoration = "none",
  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{link_decoration}{Text decoration of links. Defaults to none. Modifies
  339. the \verb{a, a > code} elements. Accepts CSS
  340. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration}{text-decoration}
  341. property values.}
  342. \item{colors}{A named vector of custom colors. The names of the colors
  343. become CSS variables and classes that can be used within your slides.
  344. For example, \code{colors = c(blue = "#bad4ed")} adds a CSS variable
  345. \code{--blue}, a \code{.blue} CSS class that applies the color to the text or
  346. foreground color, and a \code{.bg-blue} CSS class that applies the color
  347. to the background.}
  348. \item{extra_css}{A named list of CSS definitions each containing a named list
  349. of CSS property-value pairs, i.e.
  350. \code{list(".class-id" = list("css-property" = "value"))}.}
  351. \item{extra_fonts}{A list of additional fonts to import, each list element
  352. can be either a URL as a character string or a call to
  353. \code{\link{google_font}()}. To use a font imported in \code{extra_fonts}, you
  354. will need to write custom CSS rules that apply the font to an element or
  355. class with the \code{font-family} property. See the \strong{Fonts} section of
  356. \code{vignette("xaringanthemer")} for an example.}
  357. \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"}
  358. }
  359. \value{
  360. The CSS styles are written to the file path provided in \code{outfile}
  361. (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is
  362. returned directly as a character string.
  363. }
  364. \description{
  365. Creates a customized Xaringan theme CSS file.
  366. }
  367. \section{Functions}{
  368. \itemize{
  369. \item \code{xaringanthemer_font_default()}: Default values for font family, weight, URLs and
  370. font fallbacks.
  371. }}
  372. \section{Usage}{
  373. To use the styles created by this theme function, make sure
  374. that you use \code{xaringan-themer.css} as your CSS file in your slides' YAML
  375. header. If you change the name of the output file using the \code{outfile}
  376. argument, use that name instead of the default file name.
  377. \if{html}{\out{<div class="sourceCode yaml">}}\preformatted{output:
  378. xaringan::moon_reader:
  379. css: xaringan-themer.css
  380. }\if{html}{\out{</div>}}
  381. }
  382. \examples{
  383. # Create a xaringan style in a temporary file
  384. xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css")
  385. style_xaringan(
  386. text_color = "#002b3",
  387. inverse_background_color = "#31b09e",
  388. inverse_text_color = "#002b3",
  389. outfile = xaringan_themer_css # omit in your slides to write the
  390. # styles to xaringan-themer.css
  391. )
  392. # View the CSS:
  393. # file.edit(xaringan_themer_css)
  394. }
  395. \seealso{
  396. Other themes:
  397. \code{\link{style_duo}()},
  398. \code{\link{style_duo_accent}()},
  399. \code{\link{style_duo_accent_inverse}()},
  400. \code{\link{style_mono_accent}()},
  401. \code{\link{style_mono_accent_inverse}()},
  402. \code{\link{style_mono_dark}()},
  403. \code{\link{style_mono_light}()},
  404. \code{\link{style_solarized_dark}()},
  405. \code{\link{style_solarized_light}()}
  406. }
  407. \concept{themes}