😎 Give your xaringan slides some style
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

471 lines
22KB

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