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

458 lines
21KB

  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/style_duo.R
  3. \name{style_duo}
  4. \alias{style_duo}
  5. \title{Duotone Theme}
  6. \usage{
  7. style_duo(
  8. primary_color = "#1F4257",
  9. secondary_color = "#F97B64",
  10. text_color = choose_dark_or_light(primary_color, darken_color(primary_color, 0.9),
  11. lighten_color(secondary_color, 0.99)),
  12. header_color = secondary_color,
  13. background_color = primary_color,
  14. link_color = secondary_color,
  15. text_bold_color = secondary_color,
  16. text_slide_number_color = text_color,
  17. padding = "16px 64px 16px 64px",
  18. background_image = NULL,
  19. background_size = NULL,
  20. background_position = NULL,
  21. code_highlight_color = "rgba(255,255,0,0.5)",
  22. code_inline_color = secondary_color,
  23. code_inline_background_color = NULL,
  24. code_inline_font_size = "1em",
  25. inverse_background_color = secondary_color,
  26. inverse_text_color = primary_color,
  27. inverse_text_shadow = FALSE,
  28. inverse_header_color = primary_color,
  29. title_slide_text_color = secondary_color,
  30. title_slide_background_color = primary_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 = apply_alpha(secondary_color, 0.6),
  38. left_column_selected_color = secondary_color,
  39. blockquote_left_border_color = apply_alpha(secondary_color, 0.5),
  40. table_border_color = "#666",
  41. table_row_border_color = "#ddd",
  42. table_row_even_background_color = lighten_color(primary_color, 0.9),
  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.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{primary_color}{Duotone Primary Color. Defaults to #1F4257. Used in
  78. multiple CSS rules. The value of this variable is also stored as a CSS
  79. variable that can be referenced with \code{var(--primary)} in any argument of a
  80. style function or in custom CSS.}
  81. \item{secondary_color}{Duotone Secondary Color. Defaults to #F97B64. Used in
  82. multiple CSS rules. The value of this variable is also stored as a CSS
  83. variable that can be referenced with \code{var(--secondary)} in any argument of
  84. a style function or in custom CSS.}
  85. \item{text_color}{Text Color. Defaults to
  86. \code{choose_dark_or_light(primary_color, darken_color(primary_color, 0.9), lighten_color(secondary_color, 0.99))}.
  87. Modifies the \code{body} element. The value of this variable is also stored as
  88. a CSS variable that can be referenced with \code{var(--text_color)} in any
  89. argument of a style function or in custom CSS.}
  90. \item{header_color}{Header Color. Defaults to \code{secondary_color}. Modifies
  91. the \verb{h1, h2, h3} elements. The value of this variable is also stored as a
  92. CSS variable that can be referenced with \code{var(--header-color)} in any
  93. argument of a style function or in custom CSS.}
  94. \item{background_color}{Slide Background Color. Defaults to \code{primary_color}.
  95. Modifies the \code{.remark-slide-content} class. The value of this variable is
  96. also stored as a CSS variable that can be referenced with
  97. \code{var(--background-color)} in any argument of a style function or in custom
  98. CSS.}
  99. \item{link_color}{Link Color. Defaults to \code{secondary_color}. Modifies the
  100. \verb{a, a > code} elements. The value of this variable is also stored as a CSS
  101. variable that can be referenced with \code{var(--link-color)} in any argument
  102. of a style function or in custom CSS.}
  103. \item{text_bold_color}{Bold Text Color. Defaults to \code{secondary_color}.
  104. Modifies the \code{strong} element. The value of this variable is also stored
  105. as a CSS variable that can be referenced with \code{var(--text-bold-color)} in
  106. any argument of a style function or in custom CSS.}
  107. \item{text_slide_number_color}{Slide Number Color. Defaults to \code{text_color}.
  108. Modifies the \code{.remark-slide-number} class.}
  109. \item{padding}{Slide Padding in \verb{top right [bottom left]} format. Defaults
  110. to 16px 64px 16px 64px. Modifies the \code{.remark-slide-content} class.
  111. Accepts CSS
  112. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/padding}{padding}
  113. property values.}
  114. \item{background_image}{Background image applied to each \emph{and every} slide.
  115. Set \code{title_slide_background_image = "none"} to remove the background image
  116. from the title slide. Defaults to \code{NULL}. Modifies the
  117. \code{.remark-slide-content} class.}
  118. \item{background_size}{Background image size, requires \code{background_image} to
  119. be set. If \code{background_image} is set, \code{background_size} will default to
  120. \code{cover} so the background fills the screen. If both \code{background_image} and
  121. \code{background_position} are set, will default to 100 percent. Defaults to
  122. \code{NULL}. Modifies the \code{.remark-slide-content} class. Accepts CSS
  123. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-size}{background-size}
  124. property values.}
  125. \item{background_position}{Background image position, requires
  126. \code{background_image} to be set, and it is recommended to adjust
  127. \code{background_size}. Defaults to \code{NULL}. Modifies the
  128. \code{.remark-slide-content} class. Accepts CSS
  129. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}{background-position}
  130. property values.}
  131. \item{code_highlight_color}{Code Line Highlight. Defaults to
  132. rgba(255,255,0,0.5). Modifies the \code{.remark-code-line-highlighted} class.
  133. The value of this variable is also stored as a CSS variable that can be
  134. referenced with \code{var(--code-highlight-color)} in any argument of a style
  135. function or in custom CSS.}
  136. \item{code_inline_color}{Inline Code Color. Defaults to \code{secondary_color}.
  137. Modifies the \code{.remark-inline-code} class.}
  138. \item{code_inline_background_color}{Inline Code Background Color. Defaults
  139. to \code{NULL}. Modifies the \code{.remark-inline-code} class.}
  140. \item{code_inline_font_size}{Inline Code Text Font Size. Defaults to 1em.
  141. Modifies the \code{.remark-inline-code} class. Accepts CSS
  142. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  143. property values. The value of this variable is also stored as a CSS
  144. variable that can be referenced with \code{var(--code-inline-font-size)} in any
  145. argument of a style function or in custom CSS.}
  146. \item{inverse_background_color}{Inverse Background Color. Defaults to
  147. \code{secondary_color}. Modifies the \code{.inverse} class. The value of this
  148. variable is also stored as a CSS variable that can be referenced with
  149. \code{var(--inverse-background-color)} in any argument of a style function or
  150. in custom CSS.}
  151. \item{inverse_text_color}{Inverse Text Color. Defaults to \code{primary_color}.
  152. Modifies the \code{.inverse} class. The value of this variable is also stored
  153. as a CSS variable that can be referenced with \code{var(--inverse-text-color)}
  154. in any argument of a style function or in custom CSS.}
  155. \item{inverse_text_shadow}{Enables Shadow on text of inverse slides.
  156. Defaults to \code{FALSE}. Modifies the \code{.inverse} class.}
  157. \item{inverse_header_color}{Inverse Header Color. Defaults to
  158. \code{primary_color}. Modifies the \verb{.inverse h1, .inverse h2, .inverse h3}
  159. classes. The value of this variable is also stored as a CSS variable that
  160. can be referenced with \code{var(--inverse-header-color)} in any argument of a
  161. style function or in custom CSS.}
  162. \item{title_slide_text_color}{Title Slide Text Color. Defaults to
  163. \code{secondary_color}. Modifies the \code{.title-slide} class. The value of this
  164. variable is also stored as a CSS variable that can be referenced with
  165. \code{var(--title-slide-text-color)} in any argument of a style function or in
  166. custom CSS.}
  167. \item{title_slide_background_color}{Title Slide Background Color. Defaults
  168. to \code{primary_color}. Modifies the \code{.title-slide} class. The value of this
  169. variable is also stored as a CSS variable that can be referenced with
  170. \code{var(--title-slide-background-color)} in any argument of a style function
  171. or in custom CSS.}
  172. \item{title_slide_background_image}{Title Slide Background Image URL.
  173. Defaults to \code{NULL}. Modifies the \code{.title-slide} class.}
  174. \item{title_slide_background_size}{Title Slide Background Image Size,
  175. defaults to "cover" if background image is set. Defaults to \code{NULL}.
  176. Modifies the \code{.title-slide} class. Accepts CSS
  177. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-size}{background-size}
  178. property values.}
  179. \item{title_slide_background_position}{Title Slide Background Image
  180. Position. Defaults to \code{NULL}. Modifies the \code{.title-slide} class. Accepts
  181. CSS
  182. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}{background-position}
  183. property values.}
  184. \item{footnote_color}{Footnote text color (if \code{NA}, then it will be the same
  185. color as \code{text_color}). Defaults to \code{NULL}. Modifies the \code{.footnote}
  186. class.}
  187. \item{footnote_font_size}{Footnote font size. Defaults to 0.9em. Modifies
  188. the \code{.footnote} class. Accepts CSS
  189. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  190. property values.}
  191. \item{footnote_position_bottom}{Footnote location from bottom of screen.
  192. Defaults to 60px. Modifies the \code{.footnote} class. Accepts CSS
  193. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/position_value}{position}
  194. property values.}
  195. \item{left_column_subtle_color}{Left Column Text (not last). Defaults to
  196. \code{apply_alpha(secondary_color, 0.6)}. Modifies the
  197. \verb{.left-column h2, .left-column h3} classes.}
  198. \item{left_column_selected_color}{Left Column Current Selection. Defaults to
  199. \code{secondary_color}. 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 \code{apply_alpha(secondary_color, 0.5)}. 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 \code{lighten_color(primary_color, 0.9)}. Modifies the
  209. \verb{thead, tfoot, tr:nth-child(even)} 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.9em. 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_font_url}{Body Text Font URL(s). Defaults to
  283. \code{xaringanthemer_font_default("text_font_url")}. Modifies the
  284. \verb{@import url()} elements.}
  285. \item{text_font_family_fallback}{Body Text Font Fallbacks. Defaults to
  286. \code{xaringanthemer_font_default("text_font_family_fallback")}. Modifies the
  287. \code{body} element. The value of this variable is also stored as a CSS
  288. variable that can be referenced with \code{var(--text-font-family-fallback)} in
  289. any argument of a style function or in custom CSS.}
  290. \item{text_font_base}{Body Text Base Font (Total Failure Fallback). Defaults
  291. to sans-serif. Modifies the \code{body} element. The value of this variable is
  292. also stored as a CSS variable that can be referenced with
  293. \code{var(--text-font-base)} in any argument of a style function or in custom
  294. CSS.}
  295. \item{header_font_google}{Use \code{google_font()} to specify header font.
  296. Defaults to \code{NULL}. Modifies the \code{body} element.}
  297. \item{header_font_family}{Header Font Family (xaringan default is
  298. \code{'Yanone Kaffeesatz'}). Defaults to
  299. \code{xaringanthemer_font_default("header_font_family")}. Modifies the
  300. \verb{h1, h2, h3} elements. The value of this variable is also stored as a CSS
  301. variable that can be referenced with \code{var(--header-font-family)} in any
  302. argument of a style function or in custom CSS.}
  303. \item{header_font_weight}{Header Font Weight. Defaults to
  304. \code{xaringanthemer_font_default("header_font_weight")}. Modifies the
  305. \verb{h1, h2, h3} elements. Accepts CSS
  306. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight}{font-weight}
  307. property values.}
  308. \item{header_font_url}{Header Font URL. Defaults to
  309. \code{xaringanthemer_font_default("header_font_url")}. Modifies the
  310. \verb{@import url} elements.}
  311. \item{code_font_google}{Use \code{google_font()} to specify code font. Defaults
  312. to \code{NULL}. Modifies the \code{body} element.}
  313. \item{code_font_family}{Code Font Family. Defaults to
  314. \code{xaringanthemer_font_default("code_font_family")}. Modifies the
  315. \verb{.remark-code, .remark-inline-code} classes. The value of this variable is
  316. also stored as a CSS variable that can be referenced with
  317. \code{var(--code-font-family)} in any argument of a style function or in custom
  318. CSS.}
  319. \item{code_font_size}{Code Text Font Size. Defaults to 0.9rem. Modifies the
  320. \code{.remark-inline} class. Accepts CSS
  321. \href{https://developer.mozilla.org/en-US/docs/Web/CSS/font-size}{font-size}
  322. property values. The value of this variable is also stored as a CSS
  323. variable that can be referenced with \code{var(--code-font-size)} in any
  324. argument of a style function or in custom CSS.}
  325. \item{code_font_url}{Code Font URL. Defaults to
  326. \code{xaringanthemer_font_default("code_font_url")}. Modifies the \verb{@import url}
  327. elements.}
  328. \item{code_font_family_fallback}{Code Font Fallback. Defaults to
  329. \code{xaringanthemer_font_default("code_font_family_fallback")}. Modifies the
  330. \verb{.remark-code, .remark-inline-code} classes.}
  331. \item{colors}{A named vector of custom colors. The names of the colors
  332. become CSS variables and classes that can be used within your slides.
  333. For example, \code{colors = c(blue = "#bad4ed")} adds a CSS variable
  334. \code{--blue}, a \code{.blue} CSS class that applies the color to the text or
  335. foreground color, and a \code{.bg-blue} CSS class that applies the color
  336. to the background.}
  337. \item{extra_css}{A named list of CSS definitions each containing a named list
  338. of CSS property-value pairs, i.e.
  339. \code{list(".class-id" = list("css-property" = "value"))}.}
  340. \item{extra_fonts}{A list of additional fonts to import, each list element
  341. can be either a URL as a character string or a call to
  342. \code{\link{google_font}()}. To use a font imported in \code{extra_fonts}, you
  343. will need to write custom CSS rules that apply the font to an element or
  344. class with the \code{font-family} property. See the \strong{Fonts} section of
  345. \code{vignette("xaringanthemer")} for an example.}
  346. \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"}
  347. }
  348. \description{
  349. A duotone theme designed to work well with two complementary
  350. colors.
  351. }
  352. \section{Usage}{
  353. To use the styles created by this theme function, make sure
  354. that you use \code{xaringan-themer.css} as your CSS file in your slides' YAML
  355. header. If you change the name of the output file using the \code{outfile}
  356. argument, use that name instead of the default file name.\if{html}{\out{<div class="yaml">}}\preformatted{output:
  357. xaringan::moon_reader:
  358. css: xaringan-themer.css
  359. }\if{html}{\out{</div>}}
  360. }
  361. \examples{
  362. # Create a xaringan style in a temporary file
  363. xaringan_themer_css <- tempfile("xaringan-themer-", fileext = ".css")
  364. style_duo(
  365. primary_color = "#1f4257",
  366. secondary_color = "#f97b64",
  367. outfile = xaringan_themer_css # omit in your slides to write the
  368. # styles to xaringan-themer.css
  369. )
  370. # View the CSS:
  371. # file.edit(xaringan_themer_css)
  372. }
  373. \seealso{
  374. Other themes:
  375. \code{\link{style_duo_accent_inverse}()},
  376. \code{\link{style_duo_accent}()},
  377. \code{\link{style_mono_accent_inverse}()},
  378. \code{\link{style_mono_accent}()},
  379. \code{\link{style_mono_dark}()},
  380. \code{\link{style_mono_light}()},
  381. \code{\link{style_solarized_dark}()},
  382. \code{\link{style_solarized_light}()},
  383. \code{\link{xaringanthemer_font_default}()}
  384. Other Duotone themes:
  385. \code{\link{style_duo_accent_inverse}()},
  386. \code{\link{style_duo_accent}()}
  387. }
  388. \concept{Duotone themes}
  389. \concept{themes}