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

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