😎 Give your xaringan slides some style
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

463 行
21KB

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