| export(solarized_dark) | export(solarized_dark) | ||||
| export(solarized_light) | export(solarized_light) | ||||
| export(write_xaringan_theme) | export(write_xaringan_theme) | ||||
| importFrom(grDevices,col2rgb) | |||||
| importFrom(grDevices,hsv) | |||||
| importFrom(grDevices,rgb) | |||||
| importFrom(grDevices,rgb2hsv) |
| `%||%` <- function(x, y) if (is.null(x)) y else x | `%||%` <- 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 | #' @export | ||||
| lighten_color <- function(color_hex, strength = 0.7) { | lighten_color <- function(color_hex, strength = 0.7) { | ||||
| stopifnot(strength >= 0 && strength <= 1) | stopifnot(strength >= 0 && strength <= 1) | ||||
| rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255) | rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255) | ||||
| } | } | ||||
| #' @rdname lighten_darken_color | |||||
| #' @export | #' @export | ||||
| darken_color <- function(color_hex, strength = 0.8) { | darken_color <- function(color_hex, strength = 0.8) { | ||||
| stopifnot(strength >= 0 && strength <= 1) | stopifnot(strength >= 0 && strength <= 1) | ||||
| rgb(color_rgb[1], color_rgb[2], color_rgb[3], maxColorValue = 255) | 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 | #' @export | ||||
| apply_alpha <- function(color_hex, opacity = 0.5) { | apply_alpha <- function(color_hex, opacity = 0.5) { | ||||
| paste0(color_hex, as.hexmode(round(255*opacity, 0))) | paste0(color_hex, as.hexmode(round(255*opacity, 0))) | ||||
| ), class = "google_font") | ), class = "google_font") | ||||
| } | } | ||||
| #' @title List Valid Google Language Codes | |||||
| #' @seealso [google_font()] | |||||
| #' @param x Vector of potential Google language codes | |||||
| #' @export | #' @export | ||||
| google_language_codes <- function( | google_language_codes <- function( | ||||
| x = c("latin", "latin-ext", "sinhala", "greek", "hebrew", "vietnamese", | x = c("latin", "latin-ext", "sinhala", "greek", "hebrew", "vietnamese", |
| #' @importFrom grDevices col2rgb rgb rgb2hsv hsv | |||||
| #' @keywords internal | |||||
| "_PACKAGE" |
| % 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} | |||||
| } |
| % 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()}} | |||||
| } |
| % 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. | |||||
| } |
| % 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} |