| @@ -16,3 +16,7 @@ export(mono_light) | |||
| export(solarized_dark) | |||
| export(solarized_light) | |||
| export(write_xaringan_theme) | |||
| importFrom(grDevices,col2rgb) | |||
| importFrom(grDevices,hsv) | |||
| importFrom(grDevices,rgb) | |||
| importFrom(grDevices,rgb2hsv) | |||
| @@ -1,5 +1,14 @@ | |||
| `%||%` <- function(x, y) if (is.null(x)) y else x | |||
| #' @title Generate lighter or darker version of a color | |||
| #' @description Produces a linear blend of the color with white or black. | |||
| #' @param color_hex A character string representing a hex color | |||
| #' @param strength The "strength" of the blend with white or black, | |||
| #' 0 low to 1 high. | |||
| #' @name lighten_darken_color | |||
| NULL | |||
| #' @rdname lighten_darken_color | |||
| #' @export | |||
| lighten_color <- function(color_hex, strength = 0.7) { | |||
| stopifnot(strength >= 0 && strength <= 1) | |||
| @@ -8,6 +17,7 @@ lighten_color <- function(color_hex, strength = 0.7) { | |||
| rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255) | |||
| } | |||
| #' @rdname lighten_darken_color | |||
| #' @export | |||
| darken_color <- function(color_hex, strength = 0.8) { | |||
| stopifnot(strength >= 0 && strength <= 1) | |||
| @@ -16,6 +26,9 @@ darken_color <- function(color_hex, strength = 0.8) { | |||
| rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255) | |||
| } | |||
| #' @title Add alpha to hex color | |||
| #' @inheritParams lighten_darken_color | |||
| #' @param opacity Desired opacity of the output color | |||
| #' @export | |||
| apply_alpha <- function(color_hex, opacity = 0.5) { | |||
| paste0(color_hex, as.hexmode(round(255*opacity, 0))) | |||
| @@ -90,6 +103,9 @@ google_font <- function(family, ..., languages = NULL) { | |||
| ), class = "google_font") | |||
| } | |||
| #' @title List Valid Google Language Codes | |||
| #' @seealso [google_font()] | |||
| #' @param x Vector of potential Google language codes | |||
| #' @export | |||
| google_language_codes <- function( | |||
| x = c("latin", "latin-ext", "sinhala", "greek", "hebrew", "vietnamese", | |||
| @@ -0,0 +1,3 @@ | |||
| #' @importFrom grDevices col2rgb rgb rgb2hsv hsv | |||
| #' @keywords internal | |||
| "_PACKAGE" | |||
| @@ -0,0 +1,13 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/utils.R | |||
| \name{apply_alpha} | |||
| \alias{apply_alpha} | |||
| \title{Add alpha to hex color} | |||
| \usage{ | |||
| apply_alpha(color_hex, opacity = 0.5) | |||
| } | |||
| \arguments{ | |||
| \item{color_hex}{A character string representing a hex color} | |||
| \item{opacity}{Desired opacity of the output color} | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/utils.R | |||
| \name{google_language_codes} | |||
| \alias{google_language_codes} | |||
| \title{List Valid Google Language Codes} | |||
| \usage{ | |||
| google_language_codes(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")) | |||
| } | |||
| \arguments{ | |||
| \item{x}{Vector of potential Google language codes} | |||
| } | |||
| \seealso{ | |||
| \code{\link[=google_font]{google_font()}} | |||
| } | |||
| @@ -0,0 +1,21 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/utils.R | |||
| \name{lighten_darken_color} | |||
| \alias{lighten_darken_color} | |||
| \alias{lighten_color} | |||
| \alias{darken_color} | |||
| \title{Generate lighter or darker version of a color} | |||
| \usage{ | |||
| lighten_color(color_hex, strength = 0.7) | |||
| darken_color(color_hex, strength = 0.8) | |||
| } | |||
| \arguments{ | |||
| \item{color_hex}{A character string representing a hex color} | |||
| \item{strength}{The "strength" of the blend with white or black, | |||
| 0 low to 1 high.} | |||
| } | |||
| \description{ | |||
| Produces a linear blend of the color with white or black. | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| % Generated by roxygen2: do not edit by hand | |||
| % Please edit documentation in R/xaringanthemer-package.R | |||
| \docType{package} | |||
| \name{xaringanthemer-package} | |||
| \alias{xaringanthemer} | |||
| \alias{xaringanthemer-package} | |||
| \title{xaringanthemer: Xaringan CSS Theme Generator} | |||
| \description{ | |||
| Create and edit your xaringan CSS files from within your R | |||
| R Markdown slide source. More technically, this package actually creates | |||
| valid remarkjs CSS themes that are easily used by xarangan. | |||
| } | |||
| \seealso{ | |||
| Useful links: | |||
| \itemize{ | |||
| \item \url{https://github.com/gadenbuie/xaringanthemer} | |||
| \item Report bugs at \url{https://github.com/gadenbuie/xaringanthemer/issues} | |||
| } | |||
| } | |||
| \author{ | |||
| \strong{Maintainer}: Garrick Aden-Buie \email{g.adenbuie@gmail.com} | |||
| } | |||
| \keyword{internal} | |||