Selaa lähdekoodia

Initial commit, MWP

- write_xaringan_theme works
- mono_* works
tags/v0.1.1
Garrick Aden-Buie 8 vuotta sitten
commit
316f2c32c2
19 muutettua tiedostoa jossa 1464 lisäystä ja 0 poistoa
  1. +2
    -0
      .Rbuildignore
  2. +4
    -0
      .gitignore
  3. +15
    -0
      DESCRIPTION
  4. +11
    -0
      NAMESPACE
  5. +27
    -0
      R/coolors.R
  6. +359
    -0
      R/mono.R
  7. +189
    -0
      R/theme.R
  8. +74
    -0
      R/utils.R
  9. +112
    -0
      inst/resources/template.css
  10. +20
    -0
      inst/resources/template_title-slide.css
  11. +25
    -0
      man/google_font.Rd
  12. +120
    -0
      man/mono_accent.Rd
  13. +120
    -0
      man/mono_accent_inverse.Rd
  14. +121
    -0
      man/mono_dark.Rd
  15. +121
    -0
      man/mono_light.Rd
  16. +108
    -0
      man/write_xaringan_theme.Rd
  17. +4
    -0
      tests/testthat.R
  18. +11
    -0
      tests/testthat/test-coolors2colors.R
  19. +21
    -0
      xaringanthemer.Rproj

+ 2
- 0
.Rbuildignore Näytä tiedosto

@@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$

+ 4
- 0
.gitignore Näytä tiedosto

@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata

+ 15
- 0
DESCRIPTION Näytä tiedosto

@@ -0,0 +1,15 @@
Package: xaringanthemer
Type: Package
Title: What the Package Does (Title Case)
Version: 0.0.0.9000
Author: Who wrote it
Maintainer: The package maintainer <yourself@somewhere.net>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
Roxygen: list(markdown = TRUE)
Suggests:
testthat

+ 11
- 0
NAMESPACE Näytä tiedosto

@@ -0,0 +1,11 @@
# Generated by roxygen2: do not edit by hand

export(darken_color)
export(duo_theme)
export(google_font)
export(google_language_codes)
export(lighten_color)
export(mono_accent)
export(mono_accent_inverse)
export(mono_dark)
export(mono_light)

+ 27
- 0
R/coolors.R Näytä tiedosto

@@ -0,0 +1,27 @@
# Xaringan Theme from Coolors URL
# ex: https://coolors.co/fcf7f8-06d6a0-fcb0b3-f93943-7eb2dd
# ex: https://coolors.co/e06c53-ffba49-a3d9ff-d6efff-7e6b8f
# ex: https://coolors.co/ff5e5b-b9d8c2-ffffea-00cecb-ffed66
xaringan_coolors_accent <- function(coolors_url, order = "12345", ...) {
stopifnot(length(coolors_url) == 1)
colors <- coolors2colors(coolors_url)
order <- stringr::str_split(order, "")[1]
order <- unlist(purrr::map(order, as.integer))
colors <- colors[order]

colors <- list(
primary = colors[1],
secondary = colors[2],

)

return(colors)
}

coolors2colors <- function(url) {
colors <- stringr::str_extract(url, "([a-f0-9]{6}-?){5}")
colors <- stringr::str_split(colors, "-")
colors <- purrr::map(colors, ~ paste0("#", .))
if (length(colors) == 1) colors[[1]]
else colors
}

+ 359
- 0
R/mono.R Näytä tiedosto

@@ -0,0 +1,359 @@
#' Monotone Light Theme
#'
#' @param base_color Monotone Base Color, works best with a strong darkish color
#' @param white_color Color for "white". Monotone Light defaults to a very light
#' version of the `base_color`
#' @param black_color Color for "black". Monotone Light defaults to a dark,
#' nearly black version of the `base_color`
#' @param text_color Text Color
#' @param header_color Header Color
#' @param background_color Slide Background Color
#' @param link_color Link Color
#' @param text_bold_color Bold Text Color
#' @param text_slide_number_color Slide Number Color
#' @param code_highlight_color Code Line Highlight
#' @param code_inline_color Inline Code Color
#' @param code_inline_background_color Inline Code Background Color
#' @param inverse_background_color Inverse Background Color
#' @param inverse_text_color Inverse Text Color
#' @param inverse_text_shadow Enables Shadow on text of inverse slides
#' @param inverse_header_color Inverse Header Color
#' @param title_slide_text_color Title Slide Text Color
#' @param title_slide_background_color Title Slide Background Color
#' @param title_slide_background_image Title Slide Background Image URL
#' @param left_column_subtle_color Left Column Text (not last)
#' @param left_column_selected_color Left Column Current Selection
#' @param blockquote_left_color Blockquote Left Border Color
#' @param table_border_color Table top/bottom border
#' @param table_row_border_color Table row inner bottom border
#' @param table_row_even_background_color Table Even Row Background Color
#' @param text_font_google Use `google_font()` to specify body font
#' @param text_font_family Body Text Font Family
#' @param text_font_weight Body Text Font Weight
#' @param text_font_url Body Text Font URL(s)
#' @param text_font_family_fallback Body Text Font Fallbacks
#' @param text_font_base Body Text Base Font (Total Failure Fallback)
#' @param header_font_google Use `google_font()` to specify header font
#' @param header_font_family Header Font Family
#' @param header_font_weight Header Font Weight
#' @param header_font_url Header Font URL
#' @param code_font_google Use `google_font()` to specify code font
#' @param code_font_family Code Font Family
#' @param code_font_url Code Font URL
#' @param code_font_family_fallback Code Font Fallback
#' @param outfile Customized xaringan CSS output file name
#' @export
mono_light <- function(
base_color = "#23395b",
white_color = lighten_color(base_color, 0.9),
black_color = darken_color(base_color, 0.3),
text_color = black_color,
header_color = base_color,
background_color = white_color,
link_color = base_color,
text_bold_color = base_color,
text_slide_number_color = base_color,
code_highlight_color = "#ffff88",
code_inline_color = base_color,
code_inline_background_color = NA,
inverse_background_color = base_color,
inverse_text_color = white_color,
inverse_text_shadow = FALSE,
inverse_header_color = white_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = lighten_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = lighten_color(base_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(base_color, 0.8),
text_font_google = NULL,
text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif",
header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'",
header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL,
code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css"
) {
eval(parse(text = call_write_xaringan_theme()))
}

#' Monotone Dark Theme
#'
#' @param base_color Monotone Base Color, works best with a light color.
#' @param white_color Color for "white". Monotone Light defaults to a very light
#' version of the `base_color`
#' @param black_color Color for "black". Monotone Light defaults to a dark,
#' nearly black version of the `base_color`
#' @param text_color Text Color
#' @param header_color Header Color
#' @param background_color Slide Background Color
#' @param link_color Link Color
#' @param text_bold_color Bold Text Color
#' @param text_slide_number_color Slide Number Color
#' @param code_highlight_color Code Line Highlight
#' @param code_inline_color Inline Code Color
#' @param code_inline_background_color Inline Code Background Color
#' @param inverse_background_color Inverse Background Color
#' @param inverse_text_color Inverse Text Color
#' @param inverse_text_shadow Enables Shadow on text of inverse slides
#' @param inverse_header_color Inverse Header Color
#' @param title_slide_text_color Title Slide Text Color
#' @param title_slide_background_color Title Slide Background Color
#' @param title_slide_background_image Title Slide Background Image URL
#' @param left_column_subtle_color Left Column Text (not last)
#' @param left_column_selected_color Left Column Current Selection
#' @param blockquote_left_color Blockquote Left Border Color
#' @param table_border_color Table top/bottom border
#' @param table_row_border_color Table row inner bottom border
#' @param table_row_even_background_color Table Even Row Background Color
#' @param text_font_google Use `google_font()` to specify body font
#' @param text_font_family Body Text Font Family
#' @param text_font_weight Body Text Font Weight
#' @param text_font_url Body Text Font URL(s)
#' @param text_font_family_fallback Body Text Font Fallbacks
#' @param text_font_base Body Text Base Font (Total Failure Fallback)
#' @param header_font_google Use `google_font()` to specify header font
#' @param header_font_family Header Font Family
#' @param header_font_weight Header Font Weight
#' @param header_font_url Header Font URL
#' @param code_font_google Use `google_font()` to specify code font
#' @param code_font_family Code Font Family
#' @param code_font_url Code Font URL
#' @param code_font_family_fallback Code Font Fallback
#' @param outfile Customized xaringan CSS output file name
#' @export
mono_dark <- function(
base_color = "#cbf7ed",
white_color = lighten_color(base_color, 0.8),
black_color = darken_color(base_color, 0.85),
text_color = white_color,
header_color = base_color,
background_color = black_color,
link_color = base_color,
text_bold_color = base_color,
text_slide_number_color = base_color,
code_highlight_color = "#ffff88",
code_inline_color = base_color,
code_inline_background_color = NA,
inverse_background_color = base_color,
inverse_text_color = black_color,
inverse_text_shadow = FALSE,
inverse_header_color = black_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = darken_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = darken_color(base_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = darken_color(base_color, 0.7),
text_font_google = NULL,
text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif",
header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'",
header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL,
code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css"
) {
eval(parse(text = call_write_xaringan_theme()))
}

#' Monotone Accent Theme
#'
#' @param base_color Monotone Base Color
#' @param white_color Color for "white". Monotone Light defaults to a very light
#' version of the `base_color`
#' @param black_color Color for "black". Monotone Light defaults to a dark,
#' nearly black version of the `base_color`
#' @param text_color Text Color
#' @param header_color Header Color
#' @param background_color Slide Background Color
#' @param link_color Link Color
#' @param text_bold_color Bold Text Color
#' @param text_slide_number_color Slide Number Color
#' @param code_highlight_color Code Line Highlight
#' @param code_inline_color Inline Code Color
#' @param code_inline_background_color Inline Code Background Color
#' @param inverse_background_color Inverse Background Color
#' @param inverse_text_color Inverse Text Color
#' @param inverse_text_shadow Enables Shadow on text of inverse slides
#' @param inverse_header_color Inverse Header Color
#' @param title_slide_text_color Title Slide Text Color
#' @param title_slide_background_color Title Slide Background Color
#' @param title_slide_background_image Title Slide Background Image URL
#' @param left_column_subtle_color Left Column Text (not last)
#' @param left_column_selected_color Left Column Current Selection
#' @param blockquote_left_color Blockquote Left Border Color
#' @param table_border_color Table top/bottom border
#' @param table_row_border_color Table row inner bottom border
#' @param table_row_even_background_color Table Even Row Background Color
#' @param text_font_google Use `google_font()` to specify body font
#' @param text_font_family Body Text Font Family
#' @param text_font_weight Body Text Font Weight
#' @param text_font_url Body Text Font URL(s)
#' @param text_font_family_fallback Body Text Font Fallbacks
#' @param text_font_base Body Text Base Font (Total Failure Fallback)
#' @param header_font_google Use `google_font()` to specify header font
#' @param header_font_family Header Font Family
#' @param header_font_weight Header Font Weight
#' @param header_font_url Header Font URL
#' @param code_font_google Use `google_font()` to specify code font
#' @param code_font_family Code Font Family
#' @param code_font_url Code Font URL
#' @param code_font_family_fallback Code Font Fallback
#' @param outfile Customized xaringan CSS output file name
#' @export
mono_accent <- function(
base_color = "#23395b",
white_color = "#FFF",
black_color = "#272822",
text_color = black_color,
header_color = base_color,
background_color = white_color,
link_color = base_color,
text_bold_color = base_color,
text_slide_number_color = base_color,
code_highlight_color = "#ffff88",
code_inline_color = base_color,
code_inline_background_color = NA,
inverse_background_color = base_color,
inverse_text_color = white_color,
inverse_text_shadow = FALSE,
inverse_header_color = white_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = lighten_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = lighten_color(base_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(base_color, 0.7),
text_font_google = NULL,
text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif",
header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'",
header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL,
code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css"
) {
eval(parse(text = call_write_xaringan_theme()))
}

#' Monotone Accent Inverse Theme
#'
#' @param base_color Monotone Base Color
#' @param white_color Color for "white". Monotone Light defaults to a very light
#' version of the `base_color`
#' @param black_color Color for "black". Monotone Light defaults to a dark,
#' nearly black version of the `base_color`
#' @param text_color Text Color
#' @param header_color Header Color
#' @param background_color Slide Background Color
#' @param link_color Link Color
#' @param text_bold_color Bold Text Color
#' @param text_slide_number_color Slide Number Color
#' @param code_highlight_color Code Line Highlight
#' @param code_inline_color Inline Code Color
#' @param code_inline_background_color Inline Code Background Color
#' @param inverse_background_color Inverse Background Color
#' @param inverse_text_color Inverse Text Color
#' @param inverse_text_shadow Enables Shadow on text of inverse slides
#' @param inverse_header_color Inverse Header Color
#' @param title_slide_text_color Title Slide Text Color
#' @param title_slide_background_color Title Slide Background Color
#' @param title_slide_background_image Title Slide Background Image URL
#' @param left_column_subtle_color Left Column Text (not last)
#' @param left_column_selected_color Left Column Current Selection
#' @param blockquote_left_color Blockquote Left Border Color
#' @param table_border_color Table top/bottom border
#' @param table_row_border_color Table row inner bottom border
#' @param table_row_even_background_color Table Even Row Background Color
#' @param text_font_google Use `google_font()` to specify body font
#' @param text_font_family Body Text Font Family
#' @param text_font_weight Body Text Font Weight
#' @param text_font_url Body Text Font URL(s)
#' @param text_font_family_fallback Body Text Font Fallbacks
#' @param text_font_base Body Text Base Font (Total Failure Fallback)
#' @param header_font_google Use `google_font()` to specify header font
#' @param header_font_family Header Font Family
#' @param header_font_weight Header Font Weight
#' @param header_font_url Header Font URL
#' @param code_font_google Use `google_font()` to specify code font
#' @param code_font_family Code Font Family
#' @param code_font_url Code Font URL
#' @param code_font_family_fallback Code Font Fallback
#' @param outfile Customized xaringan CSS output file name
#' @export
mono_accent_inverse <- function(
base_color = "#cbf7ed",
white_color = "#FFF",
black_color = darken_color(base_color, 0.9),
text_color = white_color,
header_color = base_color,
background_color = black_color,
link_color = base_color,
text_bold_color = base_color,
text_slide_number_color = base_color,
code_highlight_color = "#ffff88",
code_inline_color = base_color,
code_inline_background_color = NA,
inverse_background_color = base_color,
inverse_text_color = black_color,
inverse_text_shadow = FALSE,
inverse_header_color = black_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = darken_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = darken_color(base_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = darken_color(base_color, 0.7),
text_font_google = NULL,
text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif",
header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'",
header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL,
code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css"
) {
eval(parse(text = call_write_xaringan_theme()))
}

+ 189
- 0
R/theme.R Näytä tiedosto

@@ -0,0 +1,189 @@

template_variables <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description
, "text_color", "#000", "body", "Text Color"
, "header_color", "#000", "h1, h2, h3", "Header Color"
, "background_color", "#FFF", ".remark-slide-content", "Slide Background Color"
, "link_color", "rgb(249, 38, 114)", "a, a > code", "Link Color"
, "text_bold_color", NA_character_, "strong", "Bold Text Color"
, "text_slide_number_color", "{inverse_background_color}", ".remark-slide-number", "Slide Number Color"
, "code_highlight_color", "#ffff88", ".remark-code-line-highlighted", "Code Line Highlight"
, "code_inline_color", "#000", ".remark-inline-code", "Inline Code Color"
, "code_inline_background_color", NA_character_, ".remark-inline-code", "Inline Code Background Color"
, "inverse_background_color", "#272822", ".inverse", "Inverse Background Color"
, "inverse_text_color", "#d6d6d6", ".inverse", "Inverse Text Color"
, "inverse_text_shadow", "{FALSE}", ".inverse", "Enables Shadow on text of inverse slides"
, "inverse_header_color", "#f3f3f3", ".inverse h1, .inverse h2, .inverse h3", "Inverse Header Color"
, "title_slide_text_color", "{inverse_text_color}", ".title-slide", "Title Slide Text Color"
, "title_slide_background_color", "{inverse_background_color}", ".title-slide", "Title Slide Background Color"
, "title_slide_background_image", NA_character_, ".title-slide", "Title Slide Background Image URL"
, "left_column_subtle_color", "#777", ".left-column", "Left Column Text (not last)"
, "left_column_selected_color", "#000", ".left-column h2:last-of-type, .left-column h3:last-child", "Left Column Current Selection"
, "blockquote_left_color", "lightgray", "blockquote", "Blockquote Left Border Color"
, "table_border_color", "#666", "table: border-top, border-bottom", "Table top/bottom border"
, "table_row_border_color", "#ddd", "table thead th: border-bottom", "Table row inner bottom border"
, "table_row_even_background_color", "#eee", "thead, tfoot, tr:nth-child(even)", "Table Even Row Background Color"
, "text_font_google", NULL, "body", "Use `google_font()` to specify body font"
, "text_font_family", "'Droid Serif'", "body", "Body Text Font Family"
, "text_font_weight", "normal", "body", "Body Text Font Weight"
, "text_font_url", "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic", "@import url()", "Body Text Font URL(s)"
, "text_font_family_fallback", "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'", "body", "Body Text Font Fallbacks"
, "text_font_base", "serif", "body", "Body Text Base Font (Total Failure Fallback)"
, "header_font_google", NULL, "body", "Use `google_font()` to specify header font"
, "header_font_family", "'Yanone Kaffeesatz'", "h1, h2, h3", "Header Font Family"
, "header_font_weight", "normal", "h1, h2, h3", "Header Font Weight"
, "header_font_url", "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz", "@import url", "Header Font URL"
, "code_font_google", NULL, "body", "Use `google_font()` to specify code font"
, "code_font_family", "'Source Code Pro'", ".remark-code, .remark-inline-code", "Code Font Family"
, "code_font_url", "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700", "@import url", "Code Font URL"
, "code_font_family_fallback", "'Lucida Console', Monaco", ".remark-code, .remark-inline-code", "Code Font Fallback"
)

#' @keywords internal
setup_theme_function <- function(
f_name = "write_xaringan_theme",
to_clipboard = TRUE,
...
) {
`%,%` <- function(x, y) c(x, y)
null_default <- purrr::map_lgl(template_variables$default, is.null)
tv <- xaringanthemer::template_variables
tv[null_default, 'default'] <- "{NULL}"
x <-
as.character(
glue::glue_data(tv,
"#' @param {variable} {description}")) %,%
"#' @param outfile Customized xaringan CSS output file name" %,%
c(...) %,%
glue("{f_name} <- function(") %,%
as.character(glue::glue_data(tv,
" {variable} = {ifelse(!stringr::str_detect(default, '^[{].+[}]$'), paste0('\"', default, '\"'), stringr::str_replace_all(default, '[{}]', ''))},")) %,%
" outfile = \"xaringan-themed.css\"" %,%
") {"
cat(x, sep = "\n",
file = if(to_clipboard) pipe("pbcopy", "w") else "")
if (to_clipboard) message("Wrote function signature to clipboard.")
}

#' @keywords internal
call_write_xaringan_theme <- function() {
paste0("write_xaringan_theme(",
paste(template_variables$variable, collapse = ", "),
")")
}

#' Write Customized Xaringan Theme
#'
#' @param text_color Text Color
#' @param header_color Header Color
#' @param background_color Slide Background Color
#' @param link_color Link Color
#' @param text_bold_color Bold Text Color
#' @param text_slide_number_color Slide Number Color
#' @param code_highlight_color Code Line Highlight
#' @param code_inline_color Inline Code Color
#' @param code_inline_background_color Inline Code Background Color
#' @param inverse_background_color Inverse Background Color
#' @param inverse_text_color Inverse Text Color
#' @param inverse_text_shadow Enables Shadow on text of inverse slides
#' @param inverse_header_color Inverse Header Color
#' @param title_slide_text_color Title Slide Text Color
#' @param title_slide_background_color Title Slide Background Color
#' @param title_slide_background_image Title Slide Background Image URL
#' @param left_column_subtle_color Left Column Text (not last)
#' @param left_column_selected_color Left Column Current Selection
#' @param blockquote_left_color Blockquote Left Border Color
#' @param table_border_color Table top/bottom border
#' @param table_row_border_color Table row inner bottom border
#' @param table_row_even_background_color Table Even Row Background Color
#' @param text_font_google Use `google_font()` to specify body font
#' @param text_font_family Body Text Font Family
#' @param text_font_weight Body Text Font Weight
#' @param text_font_url Body Text Font URL(s)
#' @param text_font_family_fallback Body Text Font Fallbacks
#' @param text_font_base Body Text Base Font (Total Failure Fallback)
#' @param header_font_google Use `google_font()` to specify header font
#' @param header_font_family Header Font Family
#' @param header_font_weight Header Font Weight
#' @param header_font_url Header Font URL
#' @param code_font_google Use `google_font()` to specify code font
#' @param code_font_family Code Font Family
#' @param code_font_url Code Font URL
#' @param code_font_family_fallback Code Font Fallback
#' @param outfile Customized xaringan CSS output file name
write_xaringan_theme <- function(
text_color = "#000",
header_color = "#000",
background_color = "#FFF",
link_color = "rgb(249, 38, 114)",
text_bold_color = NA,
text_slide_number_color = color_inverse_bg,
code_highlight_color = "#ffff88",
code_inline_color = "#000",
code_inline_background_color = NA,
inverse_background_color = "#272822",
inverse_text_color = "#d6d6d6",
inverse_text_shadow = FALSE,
inverse_header_color = "#f3f3f3",
title_slide_text_color = color_inverse_text,
title_slide_background_color = color_inverse_bg,
title_slide_background_image = NA,
left_column_subtle_color = "#777",
left_column_selected_color = "#000",
blockquote_left_color = "lightgray",
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = "#eee",
text_font_google = NULL,
text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif",
header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'",
header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL,
code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css"
) {
# Make sure font names are wrapped in quotes if they have spaces
f_args <- names(formals(sys.function()))
for (var in f_args[grepl("font_family$", f_args)]) {
eval(parse(text = paste0(
var, "<-quote_elements_w_spaces(", var, ")"
)))
}

# Use font_..._google args to overwrite font args
for (var in f_args[grepl("font_google$", f_args)]) {
gf <- eval(parse(text = var))
if (is.null(gf)) next
if (!inherits(gf, "google_font")) stop(
"`", var, "` must be set using `google_font()`."
)
group <- stringr::str_split(var, "_")[[1]][1]
if (group == "text") {
text_font_family <- gf$family
text_font_weight <- gf$weights %||% "normal"
text_font_weight <- substr(text_font_weight, 1, regexpr(",", text_font_weight)[1]-1)
text_font_url <- gf$url
} else {
for (thing in c("family", "url")) {
eval(parse(text = paste0(
group, "_font_", thing, " <- gf$", thing
)))
}
}
}

tf <- system.file("resources", "template.css", package = "xaringanthemer")
template <- readLines(tf, warn = FALSE)
template <- paste(template, collapse = "\n")
x <- glue::glue(template, .open = "{{", .close = "}}")
cat(x, file = outfile)
outfile
}

+ 74
- 0
R/utils.R Näytä tiedosto

@@ -0,0 +1,74 @@
`%||%` <- function(x, y) if (is.null(x)) y else x

#' @export
lighten_color <- function(color_hex, strength = 0.7) {
stopifnot(strength >= 0 && strength <= 1)
color_rgb <- col2rgb(color_hex)[, 1]
color_rgb <- (1 - strength) * color_rgb + strength * 255
rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255)
}

#' @export
darken_color <- function(color_hex, strength = 0.8) {
stopifnot(strength >= 0 && strength <= 1)
color_rgb <- col2rgb(color_hex)[, 1]
color_rgb <- (1 - strength) * color_rgb
rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255)
}

#' Specify Google Font
#'
#' Builds Google Fonts URL from family name. Extra weights are given in the
#' `...` parameters. Languages can be specified in `langauges` and must one or
#' more of the language codes as given by `google_language_codes()`.
#'
#' @examples
#' google_font("Josefin Sans", "400", "400i", "600i", "700")
#' google_font("Josefin Sans", languages = c("latin-ext", "vietnamese"))
#' @param family Font family
#' @param ... Font weights to include, example "400", "400i"
#' @param languages Font languages to include (dependent on the font.) See
#' [google_language_codes()].
#' @export
google_font <- function(family, ..., languages = NULL) {
base = "https://fonts.googleapis.com/css?family="
weights <- if (length(list(...))) paste(c(...), collapse = ",")
languages <- if (!is.null(languages)) paste(google_language_codes(languages), collapse = ",")
structure(list(
family = family,
weights = weights,
languages = languages,
url = paste0(
base, stringr::str_replace_all(family, " ", "+"),
if (!is.null(weights)) paste0(":", weights),
if (!is.null(languages)) paste0("&subset=", languages)
)
), class = "google_font")
}

#' @export
google_language_codes <- function(
x = c("latin", "latin-ext", "sinhala", "greek", "hebrew", "vietnamese",
"cyrillic", "cyrillic-ext", "devanagari", "arabic", "khmer",
"tamil", "greek-ext", "thai", "bengali", "gujarati", "oriya",
"malayalam", "gurmukhi", "kannada", "telugu", "myanmar")
) {
unique(match.arg(x, several.ok = TRUE))
}

print.google_font <- function(x) {
cat(
"Family: ", x$family,
if (!is.null(x$weights)) paste("\nWeights:", x$weights),
if (!is.null(x$languages)) paste("\nLangs: ", x$languages),
"\nURL: ", x$url
)
}

quote_elements_w_spaces <- function(x) {
x <- stringr::str_split(x, ", ?")[[1]]
has_space <- stringr::str_detect(x, "\\w \\w")
not_quoted <- stringr::str_detect(x, "^\\w.+\\w$")
x[has_space & not_quoted] <- paste0("'", x[has_space & not_quoted], "'")
paste(x, collapse = ", ")
}

+ 112
- 0
inst/resources/template.css Näytä tiedosto

@@ -0,0 +1,112 @@
@import url({{text_font_url}});
@import url({{header_font_url}});
@import url({{code_font_url}});

body {
font-family: {{paste(text_font_family, text_font_family_fallback, text_font_base, sep = ", ")}};
font-weight: {{text_font_weight}};
color: {{text_color}};
}
.remark-slide-content {
background-color: {{background_color}};
}

h1, h2, h3 {
font-family: {{header_font_family}};
font-weight: {{header_font_weight}};
color: {{header_color}};
}
.title-slide, .title-slide h1, .title-slide h2, .title-slide h3 {
background-color: {{title_slide_background_color}};
color: {{title_slide_text_color}};
{{ifelse(!is.na(title_slide_background_image), paste0("background-image: url(", title_slide_background_image, ");"), "")}}
{{ifelse(!is.na(title_slide_background_image), "background-size: cover;", "")}}
}
.remark-code, .remark-inline-code {
font-family: {{code_font_family}}, {{code_font_family_fallback}}, monospace;
}
.remark-inline-code {
{{ifelse(!is.na(code_inline_color), paste0("color: ", code_inline_color, ";"), "")}}
{{ifelse(!is.na(code_inline_background_color), paste0("background-color: ", code_inline_background_color, ";"), "")}}
{{ifelse(!is.na(code_inline_background_color), "padding: 2px;", "")}}
}
.remark-slide-number {
color: {{text_slide_number_color}};
opacity: 1;
}
{{ifelse(!is.na(text_bold_color), paste0("strong{color:", text_bold_color,";}"), "")}}
a, a > code {
color: {{link_color}};
text-decoration: none;
}
.footnote {
position: absolute;
bottom: 3em;
padding-right: 4em;
font-size: 90%;
}
.remark-code-line-highlighted {
background-color: {{code_highlight_color}};
}
.inverse {
background-color: {{inverse_background_color}};
color: {{inverse_text_color}};
{{ifelse(inverse_text_shadow, "text-shadow: 0 0 20px #333;", "")}}
}
.inverse h1, .inverse h2, .inverse h3 {
color: {{inverse_header_color}};
}
/* Two-column layout */
.left-column {
width: 20%;
height: 92%;
float: left;
}
.left-column h2, .left-column h3 {
color: {{left_column_subtle_color}};
}
.left-column h2:last-of-type, .left-column h3:last-child {
color: {{left_column_selected_color}};
}
.right-column {
width: 75%;
float: right;
padding-top: 1em;
}
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ * {
clear: both;
}
img, video, iframe {
max-width: 100%;
}
blockquote {
border-left: solid 5px {{blockquote_left_color}};
padding-left: 1em;
}
table {
margin: auto;
border-top: 1px solid {{table_border_color}};
border-bottom: 1px solid {{table_border_color}};
}
table thead th { border-bottom: 1px solid {{table_row_border_color}}; }
th, td { padding: 5px; }
thead, tfoot, tr:nth-child(even) { background: {{table_row_even_background_color}} }

@page { margin: 0; }
@media print {
.remark-slide-scaler {
width: 100% !important;
height: 100% !important;
transform: scale(1) !important;
top: 0 !important;
left: 0 !important;
}
}

+ 20
- 0
inst/resources/template_title-slide.css Näytä tiedosto

@@ -0,0 +1,20 @@
.title-slide, .title-slide h1, .title-slide h2, .title-slide h3 {
background-color: #fff !important;
color: #222 !important;
}
.title-slide h3 {
font-family: 'Roboto Condensed', 'Avenir Next', 'Helvetica Neue', 'Helvetica', sans-serif;
font-weight: 400;
padding-top: 15px;
font-size: 28px;
}
.title-slide h3:nth-of-type(2) {
margin-top: 10px;
font-size: 28px;
}
.title-slide table {
padding-top: 35px !important;
}
.title-slide i.fa {
font-size: 2em;
}

+ 25
- 0
man/google_font.Rd Näytä tiedosto

@@ -0,0 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{google_font}
\alias{google_font}
\title{Specify Google Font}
\usage{
google_font(family, ..., languages = NULL)
}
\arguments{
\item{family}{Font family}

\item{...}{Font weights to include, example "400", "400i"}

\item{languages}{Font languages to include (dependent on the font.) See
\code{\link[=google_language_codes]{google_language_codes()}}.}
}
\description{
Builds Google Fonts URL from family name. Extra weights are given in the
\code{...} parameters. Languages can be specified in \code{langauges} and must one or
more of the language codes as given by \code{google_language_codes()}.
}
\examples{
google_font("Josefin Sans", "400", "400i", "600i", "700")
google_font("Josefin Sans", languages = c("latin-ext", "vietnamese"))
}

+ 120
- 0
man/mono_accent.Rd Näytä tiedosto

@@ -0,0 +1,120 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mono.R
\name{mono_accent}
\alias{mono_accent}
\title{Monotone Accent Theme}
\usage{
mono_accent(base_color = "#23395b", white_color = "#FFF",
black_color = "#272822", text_color = black_color,
header_color = base_color, background_color = white_color,
link_color = base_color, text_bold_color = base_color,
text_slide_number_color = base_color, code_highlight_color = "#ffff88",
code_inline_color = base_color, code_inline_background_color = NA,
inverse_background_color = base_color, inverse_text_color = white_color,
inverse_text_shadow = FALSE, inverse_header_color = white_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = lighten_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = lighten_color(base_color, 0.5),
table_border_color = "#666", table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(base_color, 0.7),
text_font_google = NULL, text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif", header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'", header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL, code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css")
}
\arguments{
\item{base_color}{Monotone Base Color}

\item{white_color}{Color for "white". Monotone Light defaults to a very light
version of the \code{base_color}}

\item{black_color}{Color for "black". Monotone Light defaults to a dark,
nearly black version of the \code{base_color}}

\item{text_color}{Text Color}

\item{header_color}{Header Color}

\item{background_color}{Slide Background Color}

\item{link_color}{Link Color}

\item{text_bold_color}{Bold Text Color}

\item{text_slide_number_color}{Slide Number Color}

\item{code_highlight_color}{Code Line Highlight}

\item{code_inline_color}{Inline Code Color}

\item{code_inline_background_color}{Inline Code Background Color}

\item{inverse_background_color}{Inverse Background Color}

\item{inverse_text_color}{Inverse Text Color}

\item{inverse_text_shadow}{Enables Shadow on text of inverse slides}

\item{inverse_header_color}{Inverse Header Color}

\item{title_slide_text_color}{Title Slide Text Color}

\item{title_slide_background_color}{Title Slide Background Color}

\item{title_slide_background_image}{Title Slide Background Image URL}

\item{left_column_subtle_color}{Left Column Text (not last)}

\item{left_column_selected_color}{Left Column Current Selection}

\item{blockquote_left_color}{Blockquote Left Border Color}

\item{table_border_color}{Table top/bottom border}

\item{table_row_border_color}{Table row inner bottom border}

\item{table_row_even_background_color}{Table Even Row Background Color}

\item{text_font_google}{Use \code{google_font()} to specify body font}

\item{text_font_family}{Body Text Font Family}

\item{text_font_weight}{Body Text Font Weight}

\item{text_font_url}{Body Text Font URL(s)}

\item{text_font_family_fallback}{Body Text Font Fallbacks}

\item{text_font_base}{Body Text Base Font (Total Failure Fallback)}

\item{header_font_google}{Use \code{google_font()} to specify header font}

\item{header_font_family}{Header Font Family}

\item{header_font_weight}{Header Font Weight}

\item{header_font_url}{Header Font URL}

\item{code_font_google}{Use \code{google_font()} to specify code font}

\item{code_font_family}{Code Font Family}

\item{code_font_url}{Code Font URL}

\item{code_font_family_fallback}{Code Font Fallback}

\item{outfile}{Customized xaringan CSS output file name}
}
\description{
Monotone Accent Theme
}

+ 120
- 0
man/mono_accent_inverse.Rd Näytä tiedosto

@@ -0,0 +1,120 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mono.R
\name{mono_accent_inverse}
\alias{mono_accent_inverse}
\title{Monotone Accent Inverse Theme}
\usage{
mono_accent_inverse(base_color = "#cbf7ed", white_color = "#FFF",
black_color = darken_color(base_color, 0.9), text_color = white_color,
header_color = base_color, background_color = black_color,
link_color = base_color, text_bold_color = base_color,
text_slide_number_color = base_color, code_highlight_color = "#ffff88",
code_inline_color = base_color, code_inline_background_color = NA,
inverse_background_color = base_color, inverse_text_color = black_color,
inverse_text_shadow = FALSE, inverse_header_color = black_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = darken_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = darken_color(base_color, 0.5),
table_border_color = "#666", table_row_border_color = "#ddd",
table_row_even_background_color = darken_color(base_color, 0.7),
text_font_google = NULL, text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif", header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'", header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL, code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css")
}
\arguments{
\item{base_color}{Monotone Base Color}

\item{white_color}{Color for "white". Monotone Light defaults to a very light
version of the \code{base_color}}

\item{black_color}{Color for "black". Monotone Light defaults to a dark,
nearly black version of the \code{base_color}}

\item{text_color}{Text Color}

\item{header_color}{Header Color}

\item{background_color}{Slide Background Color}

\item{link_color}{Link Color}

\item{text_bold_color}{Bold Text Color}

\item{text_slide_number_color}{Slide Number Color}

\item{code_highlight_color}{Code Line Highlight}

\item{code_inline_color}{Inline Code Color}

\item{code_inline_background_color}{Inline Code Background Color}

\item{inverse_background_color}{Inverse Background Color}

\item{inverse_text_color}{Inverse Text Color}

\item{inverse_text_shadow}{Enables Shadow on text of inverse slides}

\item{inverse_header_color}{Inverse Header Color}

\item{title_slide_text_color}{Title Slide Text Color}

\item{title_slide_background_color}{Title Slide Background Color}

\item{title_slide_background_image}{Title Slide Background Image URL}

\item{left_column_subtle_color}{Left Column Text (not last)}

\item{left_column_selected_color}{Left Column Current Selection}

\item{blockquote_left_color}{Blockquote Left Border Color}

\item{table_border_color}{Table top/bottom border}

\item{table_row_border_color}{Table row inner bottom border}

\item{table_row_even_background_color}{Table Even Row Background Color}

\item{text_font_google}{Use \code{google_font()} to specify body font}

\item{text_font_family}{Body Text Font Family}

\item{text_font_weight}{Body Text Font Weight}

\item{text_font_url}{Body Text Font URL(s)}

\item{text_font_family_fallback}{Body Text Font Fallbacks}

\item{text_font_base}{Body Text Base Font (Total Failure Fallback)}

\item{header_font_google}{Use \code{google_font()} to specify header font}

\item{header_font_family}{Header Font Family}

\item{header_font_weight}{Header Font Weight}

\item{header_font_url}{Header Font URL}

\item{code_font_google}{Use \code{google_font()} to specify code font}

\item{code_font_family}{Code Font Family}

\item{code_font_url}{Code Font URL}

\item{code_font_family_fallback}{Code Font Fallback}

\item{outfile}{Customized xaringan CSS output file name}
}
\description{
Monotone Accent Inverse Theme
}

+ 121
- 0
man/mono_dark.Rd Näytä tiedosto

@@ -0,0 +1,121 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mono.R
\name{mono_dark}
\alias{mono_dark}
\title{Monotone Dark Theme}
\usage{
mono_dark(base_color = "#cbf7ed", white_color = lighten_color(base_color,
0.8), black_color = darken_color(base_color, 0.85),
text_color = white_color, header_color = base_color,
background_color = black_color, link_color = base_color,
text_bold_color = base_color, text_slide_number_color = base_color,
code_highlight_color = "#ffff88", code_inline_color = base_color,
code_inline_background_color = NA, inverse_background_color = base_color,
inverse_text_color = black_color, inverse_text_shadow = FALSE,
inverse_header_color = black_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = darken_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = darken_color(base_color, 0.5),
table_border_color = "#666", table_row_border_color = "#ddd",
table_row_even_background_color = darken_color(base_color, 0.7),
text_font_google = NULL, text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif", header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'", header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL, code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css")
}
\arguments{
\item{base_color}{Monotone Base Color, works best with a light color.}

\item{white_color}{Color for "white". Monotone Light defaults to a very light
version of the \code{base_color}}

\item{black_color}{Color for "black". Monotone Light defaults to a dark,
nearly black version of the \code{base_color}}

\item{text_color}{Text Color}

\item{header_color}{Header Color}

\item{background_color}{Slide Background Color}

\item{link_color}{Link Color}

\item{text_bold_color}{Bold Text Color}

\item{text_slide_number_color}{Slide Number Color}

\item{code_highlight_color}{Code Line Highlight}

\item{code_inline_color}{Inline Code Color}

\item{code_inline_background_color}{Inline Code Background Color}

\item{inverse_background_color}{Inverse Background Color}

\item{inverse_text_color}{Inverse Text Color}

\item{inverse_text_shadow}{Enables Shadow on text of inverse slides}

\item{inverse_header_color}{Inverse Header Color}

\item{title_slide_text_color}{Title Slide Text Color}

\item{title_slide_background_color}{Title Slide Background Color}

\item{title_slide_background_image}{Title Slide Background Image URL}

\item{left_column_subtle_color}{Left Column Text (not last)}

\item{left_column_selected_color}{Left Column Current Selection}

\item{blockquote_left_color}{Blockquote Left Border Color}

\item{table_border_color}{Table top/bottom border}

\item{table_row_border_color}{Table row inner bottom border}

\item{table_row_even_background_color}{Table Even Row Background Color}

\item{text_font_google}{Use \code{google_font()} to specify body font}

\item{text_font_family}{Body Text Font Family}

\item{text_font_weight}{Body Text Font Weight}

\item{text_font_url}{Body Text Font URL(s)}

\item{text_font_family_fallback}{Body Text Font Fallbacks}

\item{text_font_base}{Body Text Base Font (Total Failure Fallback)}

\item{header_font_google}{Use \code{google_font()} to specify header font}

\item{header_font_family}{Header Font Family}

\item{header_font_weight}{Header Font Weight}

\item{header_font_url}{Header Font URL}

\item{code_font_google}{Use \code{google_font()} to specify code font}

\item{code_font_family}{Code Font Family}

\item{code_font_url}{Code Font URL}

\item{code_font_family_fallback}{Code Font Fallback}

\item{outfile}{Customized xaringan CSS output file name}
}
\description{
Monotone Dark Theme
}

+ 121
- 0
man/mono_light.Rd Näytä tiedosto

@@ -0,0 +1,121 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mono.R
\name{mono_light}
\alias{mono_light}
\title{Monotone Light Theme}
\usage{
mono_light(base_color = "#23395b", white_color = lighten_color(base_color,
0.9), black_color = darken_color(base_color, 0.3),
text_color = black_color, header_color = base_color,
background_color = white_color, link_color = base_color,
text_bold_color = base_color, text_slide_number_color = base_color,
code_highlight_color = "#ffff88", code_inline_color = base_color,
code_inline_background_color = NA, inverse_background_color = base_color,
inverse_text_color = white_color, inverse_text_shadow = FALSE,
inverse_header_color = white_color,
title_slide_text_color = inverse_text_color,
title_slide_background_color = inverse_background_color,
title_slide_background_image = NA,
left_column_subtle_color = lighten_color(base_color, 0.5),
left_column_selected_color = base_color,
blockquote_left_color = lighten_color(base_color, 0.5),
table_border_color = "#666", table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(base_color, 0.8),
text_font_google = NULL, text_font_family = "'Droid Serif'",
text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif", header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'", header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL, code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css")
}
\arguments{
\item{base_color}{Monotone Base Color, works best with a strong darkish color}

\item{white_color}{Color for "white". Monotone Light defaults to a very light
version of the \code{base_color}}

\item{black_color}{Color for "black". Monotone Light defaults to a dark,
nearly black version of the \code{base_color}}

\item{text_color}{Text Color}

\item{header_color}{Header Color}

\item{background_color}{Slide Background Color}

\item{link_color}{Link Color}

\item{text_bold_color}{Bold Text Color}

\item{text_slide_number_color}{Slide Number Color}

\item{code_highlight_color}{Code Line Highlight}

\item{code_inline_color}{Inline Code Color}

\item{code_inline_background_color}{Inline Code Background Color}

\item{inverse_background_color}{Inverse Background Color}

\item{inverse_text_color}{Inverse Text Color}

\item{inverse_text_shadow}{Enables Shadow on text of inverse slides}

\item{inverse_header_color}{Inverse Header Color}

\item{title_slide_text_color}{Title Slide Text Color}

\item{title_slide_background_color}{Title Slide Background Color}

\item{title_slide_background_image}{Title Slide Background Image URL}

\item{left_column_subtle_color}{Left Column Text (not last)}

\item{left_column_selected_color}{Left Column Current Selection}

\item{blockquote_left_color}{Blockquote Left Border Color}

\item{table_border_color}{Table top/bottom border}

\item{table_row_border_color}{Table row inner bottom border}

\item{table_row_even_background_color}{Table Even Row Background Color}

\item{text_font_google}{Use \code{google_font()} to specify body font}

\item{text_font_family}{Body Text Font Family}

\item{text_font_weight}{Body Text Font Weight}

\item{text_font_url}{Body Text Font URL(s)}

\item{text_font_family_fallback}{Body Text Font Fallbacks}

\item{text_font_base}{Body Text Base Font (Total Failure Fallback)}

\item{header_font_google}{Use \code{google_font()} to specify header font}

\item{header_font_family}{Header Font Family}

\item{header_font_weight}{Header Font Weight}

\item{header_font_url}{Header Font URL}

\item{code_font_google}{Use \code{google_font()} to specify code font}

\item{code_font_family}{Code Font Family}

\item{code_font_url}{Code Font URL}

\item{code_font_family_fallback}{Code Font Fallback}

\item{outfile}{Customized xaringan CSS output file name}
}
\description{
Monotone Light Theme
}

+ 108
- 0
man/write_xaringan_theme.Rd Näytä tiedosto

@@ -0,0 +1,108 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/theme.R
\name{write_xaringan_theme}
\alias{write_xaringan_theme}
\title{Write Customized Xaringan Theme}
\usage{
write_xaringan_theme(text_color = "#000", header_color = "#000",
background_color = "#FFF", link_color = "rgb(249, 38, 114)",
text_bold_color = NA, text_slide_number_color = color_inverse_bg,
code_highlight_color = "#ffff88", code_inline_color = "#000",
code_inline_background_color = NA, inverse_background_color = "#272822",
inverse_text_color = "#d6d6d6", inverse_text_shadow = FALSE,
inverse_header_color = "#f3f3f3",
title_slide_text_color = color_inverse_text,
title_slide_background_color = color_inverse_bg,
title_slide_background_image = NA, left_column_subtle_color = "#777",
left_column_selected_color = "#000", blockquote_left_color = "lightgray",
table_border_color = "#666", table_row_border_color = "#ddd",
table_row_even_background_color = "#eee", text_font_google = NULL,
text_font_family = "'Droid Serif'", text_font_weight = "normal",
text_font_url = "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic",
text_font_family_fallback = "'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC'",
text_font_base = "serif", header_font_google = NULL,
header_font_family = "'Yanone Kaffeesatz'", header_font_weight = "normal",
header_font_url = "https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz",
code_font_google = NULL, code_font_family = "'Source Code Pro'",
code_font_url = "https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700",
code_font_family_fallback = "'Lucida Console', Monaco",
outfile = "xaringan-themed.css")
}
\arguments{
\item{text_color}{Text Color}

\item{header_color}{Header Color}

\item{background_color}{Slide Background Color}

\item{link_color}{Link Color}

\item{text_bold_color}{Bold Text Color}

\item{text_slide_number_color}{Slide Number Color}

\item{code_highlight_color}{Code Line Highlight}

\item{code_inline_color}{Inline Code Color}

\item{code_inline_background_color}{Inline Code Background Color}

\item{inverse_background_color}{Inverse Background Color}

\item{inverse_text_color}{Inverse Text Color}

\item{inverse_text_shadow}{Enables Shadow on text of inverse slides}

\item{inverse_header_color}{Inverse Header Color}

\item{title_slide_text_color}{Title Slide Text Color}

\item{title_slide_background_color}{Title Slide Background Color}

\item{title_slide_background_image}{Title Slide Background Image URL}

\item{left_column_subtle_color}{Left Column Text (not last)}

\item{left_column_selected_color}{Left Column Current Selection}

\item{blockquote_left_color}{Blockquote Left Border Color}

\item{table_border_color}{Table top/bottom border}

\item{table_row_border_color}{Table row inner bottom border}

\item{table_row_even_background_color}{Table Even Row Background Color}

\item{text_font_google}{Use \code{google_font()} to specify body font}

\item{text_font_family}{Body Text Font Family}

\item{text_font_weight}{Body Text Font Weight}

\item{text_font_url}{Body Text Font URL(s)}

\item{text_font_family_fallback}{Body Text Font Fallbacks}

\item{text_font_base}{Body Text Base Font (Total Failure Fallback)}

\item{header_font_google}{Use \code{google_font()} to specify header font}

\item{header_font_family}{Header Font Family}

\item{header_font_weight}{Header Font Weight}

\item{header_font_url}{Header Font URL}

\item{code_font_google}{Use \code{google_font()} to specify code font}

\item{code_font_family}{Code Font Family}

\item{code_font_url}{Code Font URL}

\item{code_font_family_fallback}{Code Font Fallback}

\item{outfile}{Customized xaringan CSS output file name}
}
\description{
Write Customized Xaringan Theme
}

+ 4
- 0
tests/testthat.R Näytä tiedosto

@@ -0,0 +1,4 @@
library(testthat)
library(xaringanthemer)

test_check("xaringanthemer")

+ 11
- 0
tests/testthat/test-coolors2colors.R Näytä tiedosto

@@ -0,0 +1,11 @@
context("test-coolors2colors.R")

test_that("coolors2colors takes urls and makes #COLORS", {
urls <- c("https://coolors.co/fcf7f8-06d6a0-fcb0b3-f93943-7eb2dd",
"https://coolors.co/e06c53-ffba49-a3d9ff-d6efff-7e6b8f",
"https://coolors.co/ff5e5b-b9d8c2-ffffea-00cecb-ffed66")

expect_equal(coolors2colors(urls[1]), c("#fcf7f8", "#06d6a0", "#fcb0b3", "#f93943", "#7eb2dd"))
expect_equal(coolors2colors(urls[2]), c("#e06c53", "#ffba49", "#a3d9ff", "#d6efff", "#7e6b8f"))
expect_equal(coolors2colors(urls[3]), c("#ff5e5b", "#b9d8c2", "#ffffea", "#00cecb", "#ffed66"))
})

+ 21
- 0
xaringanthemer.Rproj Näytä tiedosto

@@ -0,0 +1,21 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: XeLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace

Loading…
Peruuta
Tallenna