Просмотр исходного кода

Soften table_row_even_background_color defaults

tags/v0.3.0
Garrick Aden-Buie 6 лет назад
Родитель
Сommit
f0912713b9
8 измененных файлов: 30 добавлений и 30 удалений
  1. +2
    -2
      R/style_duo.R
  2. +2
    -2
      R/style_duo_accent.R
  3. +2
    -2
      R/style_duo_accent_inverse.R
  4. +14
    -14
      R/style_xaringan.R
  5. +4
    -4
      R/theme_settings.R
  6. +2
    -2
      man/style_duo.Rd
  7. +2
    -2
      man/style_duo_accent.Rd
  8. +2
    -2
      man/style_duo_accent_inverse.Rd

+ 2
- 2
R/style_duo.R Просмотреть файл

@@ -31,7 +31,7 @@
#' @param blockquote_left_border_color Blockquote Left Border Color. Defaults to `apply_alpha(secondary_color, 0.5)`. Modifies the `blockquote` element.
#' @param table_border_color Table top/bottom border. Defaults to #666. Modifies the `table: border-top, border-bottom` elements.
#' @param table_row_border_color Table row inner bottom border. Defaults to #ddd. Modifies the `table thead th: border-bottom` elements.
#' @param table_row_even_background_color Table Even Row Background Color. Defaults to `lighten_color(primary_color, 0.3)`. Modifies the `thead, tfoot, tr:nth-child(even)` elements.
#' @param table_row_even_background_color Table Even Row Background Color. Defaults to `lighten_color(primary_color, 0.1)`. Modifies the `thead, tfoot, tr:nth-child(even)` elements.
#' @param base_font_size Base Font Size for All Slide Elements (must be `px`). Defaults to 20px. Modifies the `html` element.
#' @param text_font_size Slide Body Text Font Size. Defaults to 1rem. Modifies the `.remark-slide-content` class.
#' @param header_h1_font_size h1 Header Text Font Size. Defaults to 2.75rem. Modifies the `.remark-slide-content h1` class.
@@ -97,7 +97,7 @@ style_duo <- function(
blockquote_left_border_color = apply_alpha(secondary_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(primary_color, 0.3),
table_row_even_background_color = lighten_color(primary_color, 0.1),
base_font_size = "20px",
text_font_size = "1rem",
header_h1_font_size = "2.75rem",

+ 2
- 2
R/style_duo_accent.R Просмотреть файл

@@ -33,7 +33,7 @@
#' @param blockquote_left_border_color Blockquote Left Border Color. Defaults to `apply_alpha(secondary_color, 0.5)`. Modifies the `blockquote` element.
#' @param table_border_color Table top/bottom border. Defaults to #666. Modifies the `table: border-top, border-bottom` elements.
#' @param table_row_border_color Table row inner bottom border. Defaults to #ddd. Modifies the `table thead th: border-bottom` elements.
#' @param table_row_even_background_color Table Even Row Background Color. Defaults to `lighten_color(secondary_color, 0.3)`. Modifies the `thead, tfoot, tr:nth-child(even)` elements.
#' @param table_row_even_background_color Table Even Row Background Color. Defaults to `lighten_color(secondary_color, 0.2)`. Modifies the `thead, tfoot, tr:nth-child(even)` elements.
#' @param base_font_size Base Font Size for All Slide Elements (must be `px`). Defaults to 20px. Modifies the `html` element.
#' @param text_font_size Slide Body Text Font Size. Defaults to 1rem. Modifies the `.remark-slide-content` class.
#' @param header_h1_font_size h1 Header Text Font Size. Defaults to 2.75rem. Modifies the `.remark-slide-content h1` class.
@@ -101,7 +101,7 @@ style_duo_accent <- function(
blockquote_left_border_color = apply_alpha(secondary_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(secondary_color, 0.3),
table_row_even_background_color = lighten_color(secondary_color, 0.2),
base_font_size = "20px",
text_font_size = "1rem",
header_h1_font_size = "2.75rem",

+ 2
- 2
R/style_duo_accent_inverse.R Просмотреть файл

@@ -33,7 +33,7 @@
#' @param blockquote_left_border_color Blockquote Left Border Color. Defaults to `apply_alpha(secondary_color, 0.5)`. Modifies the `blockquote` element.
#' @param table_border_color Table top/bottom border. Defaults to #666. Modifies the `table: border-top, border-bottom` elements.
#' @param table_row_border_color Table row inner bottom border. Defaults to #ddd. Modifies the `table thead th: border-bottom` elements.
#' @param table_row_even_background_color Table Even Row Background Color. Defaults to `darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.3)`. Modifies the `thead, tfoot, tr:nth-child(even)` elements.
#' @param table_row_even_background_color Table Even Row Background Color. Defaults to `darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.2)`. Modifies the `thead, tfoot, tr:nth-child(even)` elements.
#' @param base_font_size Base Font Size for All Slide Elements (must be `px`). Defaults to 20px. Modifies the `html` element.
#' @param text_font_size Slide Body Text Font Size. Defaults to 1rem. Modifies the `.remark-slide-content` class.
#' @param header_h1_font_size h1 Header Text Font Size. Defaults to 2.75rem. Modifies the `.remark-slide-content h1` class.
@@ -101,7 +101,7 @@ style_duo_accent_inverse <- function(
blockquote_left_border_color = apply_alpha(secondary_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.3),
table_row_even_background_color = darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.2),
base_font_size = "20px",
text_font_size = "1rem",
header_h1_font_size = "2.75rem",

+ 14
- 14
R/style_xaringan.R Просмотреть файл

@@ -35,7 +35,7 @@
#' @param header_h1_font_size h1 Header Text Font Size. Defaults to 2.75rem. Modifies the `.remark-slide-content h1` class.
#' @param header_h2_font_size h2 Header Text Font Size. Defaults to 2.25rem. Modifies the `.remark-slide-content h2` class.
#' @param header_h3_font_size h3 Header Text Font Size. Defaults to 1.75rem. Modifies the `.remark-slide-content h3` class.
#' @param header_background_auto Add background under slide title automatically for h1 header elements. If not enabled, use `class: header_background` to enable. Defaults to `FALSE`.
#' @param header_background_auto Add background under slide title automatically for h1 header elements. If not enabled, use `class: header_background` to enable. Defaults to `FALSE`.
#' @param header_background_color Background Color for h1 Header with Background. Defaults to `header_color`. Modifies the `.remark-slide-content h1` class.
#' @param header_background_text_color Text Color for h1 Header with Background. Defaults to `background_color`. Modifies the `.remark-slide-content h1` class.
#' @param header_background_padding Padding for h1 Header with Background. Defaults to `NULL`. Modifies the `.remark-slide-content h1` class.
@@ -136,7 +136,7 @@ style_xaringan <- function(
# set an is_google flag default of FALSE that is possibly overwritten later
eval(parse(text = paste0(sub("font_family$", "font_is_google", var), "<-0")))
}
# Warn if base_font_size isn't absolute
css_abs_units <- c("cm", "mm", "Q", "in", "pc", "pt", "px")
if (!grepl(paste(tolower(css_abs_units), collapse = "|"), tolower(base_font_size))) {
@@ -150,7 +150,7 @@ style_xaringan <- function(
immediate. = TRUE
)
}
# Use font_..._google args to overwrite font args
for (var in f_args[grepl("font_google$", f_args)]) {
gf <- eval(parse(text = var))
@@ -170,17 +170,17 @@ style_xaringan <- function(
}
eval(parse(text = paste0(group, "_font_is_google <- 1")))
}
is_default <- function(type, suffix, reference = style_xaringan) {
var <- paste0(type, "_", suffix)
default_value <- formals(reference)[[var]]
if (suffix == "font_family") {
default_value <- quote_elements_w_spaces(default_value)
}
get(var, envir = parent.frame(2), inherits = FALSE) == default_value
}
# the defaults are google fonts
for (var in c("text", "header", "code")) {
suffixes <- c("font_family", "font_weight", "font_url")
@@ -190,10 +190,10 @@ style_xaringan <- function(
eval(parse(text = paste0(var, "_font_is_google <- 1")))
}
}
extra_font_imports <- if (is.null(extra_fonts)) "" else list2fonts(extra_fonts)
extra_font_imports <- paste(extra_font_imports, collapse = "\n")
# convert NA arguments to NULL
for (var in f_args) {
val <- eval(parse(text = var))
@@ -202,7 +202,7 @@ style_xaringan <- function(
is_na <- length(val) == 0
if (is_na) assign(var, NULL)
}
# prepare variables for template
body_font_family <- paste(c(text_font_family, text_font_family_fallback, text_font_base), collapse = ", ")
background_size_fallback <- if (is.null(background_position)) "cover" else "100%"
@@ -211,7 +211,7 @@ style_xaringan <- function(
title_slide_background_image %??% "cover"
)
table_row_even_background_color <- table_row_even_background_color %||% background_color
# stash theme settings in package env
lapply(f_args, function(n) assign(n, get(n), envir = xaringanthemer_env))
for (font_is_google in paste0(c("text", "code", "header"), "_font_is_google")) {
@@ -221,9 +221,9 @@ style_xaringan <- function(
envir = xaringanthemer_env
)
}
xaringanthemer_version <- utils::packageVersion("xaringanthemer")
# prepare header background object
needs_leading_dot <- !grepl("^\\.", header_background_ignore_classes)
header_background_ignore_classes[needs_leading_dot] <- paste0(
@@ -248,9 +248,9 @@ style_xaringan <- function(
content_padding_top = header_background_content_padding_top,
ignore = header_background_ignore_classes
)
colors <- prepare_colors(colors)
tf <- system.file("resources", "template.css", package = "xaringanthemer")
template <- readLines(tf, warn = FALSE)
template <- paste(template, collapse = "\n")

+ 4
- 4
R/theme_settings.R Просмотреть файл

@@ -189,7 +189,7 @@ template_duo_light <- set_default(
left_column_subtle_color = "{apply_alpha(secondary_color, 0.6)}",
left_column_selected_color = "{secondary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{lighten_color(secondary_color, 0.7)}")
table_row_even_background_color = "{lighten_color(secondary_color, 0.9)}")

template_duo <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description
@@ -214,7 +214,7 @@ template_duo <- set_default(
left_column_subtle_color = "{apply_alpha(secondary_color, 0.6)}",
left_column_selected_color = "{secondary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{lighten_color(primary_color, 0.3)}")
table_row_even_background_color = "{lighten_color(primary_color, 0.1)}")

template_duo_accent <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description
@@ -241,7 +241,7 @@ template_duo_accent <- set_default(
left_column_subtle_color = "{apply_alpha(primary_color, 0.6)}",
left_column_selected_color = "{primary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{lighten_color(secondary_color, 0.3)}")
table_row_even_background_color = "{lighten_color(secondary_color, 0.2)}")

template_duo_accent_inverse <- set_default(
template_duo_accent,
@@ -260,7 +260,7 @@ template_duo_accent_inverse <- set_default(
left_column_subtle_color = "{apply_alpha(primary_color, 0.6)}",
left_column_selected_color = "{primary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.3)}")
table_row_even_background_color = "{darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.2)}")

solarized <- list(
"base03" = "#002b36",

+ 2
- 2
man/style_duo.Rd Просмотреть файл

@@ -39,7 +39,7 @@ style_duo(
blockquote_left_border_color = apply_alpha(secondary_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(primary_color, 0.3),
table_row_even_background_color = lighten_color(primary_color, 0.1),
base_font_size = "20px",
text_font_size = "1rem",
header_h1_font_size = "2.75rem",
@@ -144,7 +144,7 @@ style_duo(

\item{table_row_border_color}{Table row inner bottom border. Defaults to #ddd. Modifies the \verb{table thead th: border-bottom} elements.}

\item{table_row_even_background_color}{Table Even Row Background Color. Defaults to \code{lighten_color(primary_color, 0.3)}. Modifies the \verb{thead, tfoot, tr:nth-child(even)} elements.}
\item{table_row_even_background_color}{Table Even Row Background Color. Defaults to \code{lighten_color(primary_color, 0.1)}. Modifies the \verb{thead, tfoot, tr:nth-child(even)} elements.}

\item{base_font_size}{Base Font Size for All Slide Elements (must be \code{px}). Defaults to 20px. Modifies the \code{html} element.}


+ 2
- 2
man/style_duo_accent.Rd Просмотреть файл

@@ -42,7 +42,7 @@ style_duo_accent(
blockquote_left_border_color = apply_alpha(secondary_color, 0.5),
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = lighten_color(secondary_color, 0.3),
table_row_even_background_color = lighten_color(secondary_color, 0.2),
base_font_size = "20px",
text_font_size = "1rem",
header_h1_font_size = "2.75rem",
@@ -151,7 +151,7 @@ style_duo_accent(

\item{table_row_border_color}{Table row inner bottom border. Defaults to #ddd. Modifies the \verb{table thead th: border-bottom} elements.}

\item{table_row_even_background_color}{Table Even Row Background Color. Defaults to \code{lighten_color(secondary_color, 0.3)}. Modifies the \verb{thead, tfoot, tr:nth-child(even)} elements.}
\item{table_row_even_background_color}{Table Even Row Background Color. Defaults to \code{lighten_color(secondary_color, 0.2)}. Modifies the \verb{thead, tfoot, tr:nth-child(even)} elements.}

\item{base_font_size}{Base Font Size for All Slide Elements (must be \code{px}). Defaults to 20px. Modifies the \code{html} element.}


+ 2
- 2
man/style_duo_accent_inverse.Rd Просмотреть файл

@@ -43,7 +43,7 @@ style_duo_accent_inverse(
table_border_color = "#666",
table_row_border_color = "#ddd",
table_row_even_background_color = darken_color(choose_dark_or_light(primary_color,
secondary_color, primary_color), 0.3),
secondary_color, primary_color), 0.2),
base_font_size = "20px",
text_font_size = "1rem",
header_h1_font_size = "2.75rem",
@@ -152,7 +152,7 @@ style_duo_accent_inverse(

\item{table_row_border_color}{Table row inner bottom border. Defaults to #ddd. Modifies the \verb{table thead th: border-bottom} elements.}

\item{table_row_even_background_color}{Table Even Row Background Color. Defaults to \code{darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.3)}. Modifies the \verb{thead, tfoot, tr:nth-child(even)} elements.}
\item{table_row_even_background_color}{Table Even Row Background Color. Defaults to \code{darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.2)}. Modifies the \verb{thead, tfoot, tr:nth-child(even)} elements.}

\item{base_font_size}{Base Font Size for All Slide Elements (must be \code{px}). Defaults to 20px. Modifies the \code{html} element.}


Загрузка…
Отмена
Сохранить