| #' scales::show_col(c(blue_light, blue, blue_dark)) | #' scales::show_col(c(blue_light, blue, blue_dark)) | ||||
| #' } | #' } | ||||
| #' | #' | ||||
| #' @return A character string with the lightened or darkened color in | |||||
| #' hexadecimal format. | |||||
| #' @name lighten_darken_color | #' @name lighten_darken_color | ||||
| NULL | NULL | ||||
| #' scales::show_col(c(blue, blue_transparent)) | #' scales::show_col(c(blue, blue_transparent)) | ||||
| #' } | #' } | ||||
| #' | #' | ||||
| #' @return A character string with added opacity level as hexadecimal characters. | |||||
| #' @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))) | ||||
| #' scales::show_col(c(light_green, contrast_green, dark_purple, contrast_purple)) | #' scales::show_col(c(light_green, contrast_green, dark_purple, contrast_purple)) | ||||
| #' } | #' } | ||||
| #' | #' | ||||
| #' @return The `black` color or `white` color according to which color provides | |||||
| #' the greates contrast with the input color. | |||||
| #' | |||||
| #' @export | #' @export | ||||
| choose_dark_or_light <- function(x, black = "#000000", white = "#FFFFFF") { | choose_dark_or_light <- function(x, black = "#000000", white = "#FFFFFF") { | ||||
| if (is_light_color(x)) eval(black) else eval(white) | if (is_light_color(x)) eval(black) else eval(white) |
| #' theme_xaringan_get_value("header_color") | #' theme_xaringan_get_value("header_color") | ||||
| #' theme_xaringan_get_value("text_bold_color") | #' theme_xaringan_get_value("text_bold_color") | ||||
| #' | #' | ||||
| #' @return The value of the xaringanthemer style parameter. | |||||
| #' @export | #' @export | ||||
| theme_xaringan_get_value <- function(setting, css_file = NULL) { | theme_xaringan_get_value <- function(setting, css_file = NULL) { | ||||
| requires_xaringanthemer_env(css_file = css_file) | requires_xaringanthemer_env(css_file = css_file) |
| #' @param ... Font weights to include, example "400", "400i" | #' @param ... Font weights to include, example "400", "400i" | ||||
| #' @param languages Font languages to include (dependent on the font.) See | #' @param languages Font languages to include (dependent on the font.) See | ||||
| #' [google_language_codes()]. | #' [google_language_codes()]. | ||||
| #' @return A `"google_font"` object. | |||||
| #' @export | #' @export | ||||
| google_font <- function(family, ..., languages = NULL) { | google_font <- function(family, ..., languages = NULL) { | ||||
| base <- "https://fonts.googleapis.com/css?family=" | base <- "https://fonts.googleapis.com/css?family=" | ||||
| #' validates that the language codes given are valid. | #' validates that the language codes given are valid. | ||||
| #' @seealso [google_font()] | #' @seealso [google_font()] | ||||
| #' @param language_codes Vector of potential Google language codes | #' @param language_codes Vector of potential Google language codes | ||||
| #' @return A vector of Google Font language codes matching `language_codes`. | |||||
| #' @export | #' @export | ||||
| google_language_codes <- function( | google_language_codes <- function( | ||||
| language_codes = c( | language_codes = c( |
| #' | #' | ||||
| #' These functions in xaringanthemer have been deprecated or renamed. | #' These functions in xaringanthemer have been deprecated or renamed. | ||||
| #' | #' | ||||
| #' @param ... Argumets passed to the new or renamed functions. | |||||
| #' @return The result of the new or renamed function. | |||||
| #' @name xaringanthemer-deprecated | #' @name xaringanthemer-deprecated | ||||
| NULL | NULL | ||||
| #' xaringan::moon_reader: | #' xaringan::moon_reader: | ||||
| #' css: xaringan-themer.css | #' css: xaringan-themer.css | ||||
| #' ```` | #' ```` | ||||
| # | |||||
| #' | |||||
| #' @return The CSS styles are written to the file path provided in `outfile` | |||||
| #' (by default to `xaringan-themer.css`). If `outfile` is `NULL`, the CSS is | |||||
| #' returned directly as a character string. | |||||
| #' |
| \item{opacity}{Desired opacity of the output color} | \item{opacity}{Desired opacity of the output color} | ||||
| } | } | ||||
| \value{ | |||||
| A character string with added opacity level as hexadecimal characters. | |||||
| } | |||||
| \description{ | \description{ | ||||
| Applies alpha (or opacity) to a color in hexadecimal form by | Applies alpha (or opacity) to a color in hexadecimal form by | ||||
| converting opacity in the \verb{[0, 1]} range to hex in the \verb{[0, 255]} range | converting opacity in the \verb{[0, 1]} range to hex in the \verb{[0, 255]} range |
| \item{white}{Text or foreground color or expression, e.g. "#EEE" or | \item{white}{Text or foreground color or expression, e.g. "#EEE" or | ||||
| \code{substitute(lighten_color(x, 0.8))}, if white text provides the best contrast.} | \code{substitute(lighten_color(x, 0.8))}, if white text provides the best contrast.} | ||||
| } | } | ||||
| \value{ | |||||
| The \code{black} color or \code{white} color according to which color provides | |||||
| the greates contrast with the input color. | |||||
| } | |||||
| \description{ | \description{ | ||||
| Takes a color input as \code{x} and returns either the black or white color (or | Takes a color input as \code{x} and returns either the black or white color (or | ||||
| expression) if dark or light text should be used over the input color for | expression) if dark or light text should be used over the input color for |
| \item{languages}{Font languages to include (dependent on the font.) See | \item{languages}{Font languages to include (dependent on the font.) See | ||||
| \code{\link[=google_language_codes]{google_language_codes()}}.} | \code{\link[=google_language_codes]{google_language_codes()}}.} | ||||
| } | } | ||||
| \value{ | |||||
| A \code{"google_font"} object. | |||||
| } | |||||
| \description{ | \description{ | ||||
| Builds Google Fonts URL from family name. Extra weights are given in the | 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 | \code{...} parameters. Languages can be specified in \code{langauges} and must one or |
| \arguments{ | \arguments{ | ||||
| \item{language_codes}{Vector of potential Google language codes} | \item{language_codes}{Vector of potential Google language codes} | ||||
| } | } | ||||
| \value{ | |||||
| A vector of Google Font language codes matching \code{language_codes}. | |||||
| } | |||||
| \description{ | \description{ | ||||
| Gives a list of valid Language Codes for Google Fonts, or | Gives a list of valid Language Codes for Google Fonts, or | ||||
| validates that the language codes given are valid. | validates that the language codes given are valid. |
| where 0 is entirely the original color and 1 is entirely white | where 0 is entirely the original color and 1 is entirely white | ||||
| (\code{lighten_color()}) or black (\code{darken_color()}).} | (\code{lighten_color()}) or black (\code{darken_color()}).} | ||||
| } | } | ||||
| \value{ | |||||
| A character string with the lightened or darkened color in | |||||
| hexadecimal format. | |||||
| } | |||||
| \description{ | \description{ | ||||
| Produces a linear blend of the color with white or black. | Produces a linear blend of the color with white or black. | ||||
| } | } |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| A duotone theme designed to work well with two complementary | A duotone theme designed to work well with two complementary | ||||
| colors. | colors. |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| An default xaringan theme with a two colors used for color | An default xaringan theme with a two colors used for color | ||||
| accents on select elements (headers, bold text, etc.). | accents on select elements (headers, bold text, etc.). |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| An "inverted" default xaringan theme with a two colors used | An "inverted" default xaringan theme with a two colors used | ||||
| for color accents on select elements (headers, bold text, etc.). | for color accents on select elements (headers, bold text, etc.). |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| The default xaringan theme with a single color used for color | The default xaringan theme with a single color used for color | ||||
| accents on select elements (headers, bold text, etc.). | accents on select elements (headers, bold text, etc.). |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| An "inverted" default xaringan theme with a single color used | An "inverted" default xaringan theme with a single color used | ||||
| for color accents on select elements (headers, bold text, etc.). | for color accents on select elements (headers, bold text, etc.). |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| A dark monotone theme based around a single color. | A dark monotone theme based around a single color. | ||||
| } | } |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| A light monotone theme based around a single color. | A light monotone theme based around a single color. | ||||
| } | } |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| A dark theme based around on the solarized color scheme. | A dark theme based around on the solarized color scheme. | ||||
| Works well with "\code{highlightStyle: solarized-dark}" or | Works well with "\code{highlightStyle: solarized-dark}" or |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| A light theme based around on the solarized color scheme. | A light theme based around on the solarized color scheme. | ||||
| Works well with "\code{highlightStyle: solarized-dark}" or | Works well with "\code{highlightStyle: solarized-dark}" or |
| \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | \item{outfile}{Customized xaringan CSS output file name, default is "xaringan-themer.css"} | ||||
| } | } | ||||
| \value{ | |||||
| The CSS styles are written to the file path provided in \code{outfile} | |||||
| (by default to \code{xaringan-themer.css}). If \code{outfile} is \code{NULL}, the CSS is | |||||
| returned directly as a character string. | |||||
| } | |||||
| \description{ | \description{ | ||||
| Creates a customized Xaringan theme CSS file. | Creates a customized Xaringan theme CSS file. | ||||
| } | } |
| if you have only saved your theme CSS file and you aren't creating your | if you have only saved your theme CSS file and you aren't creating your | ||||
| CSS theme with \pkg{xaringanthemer} in your slides' source file.} | CSS theme with \pkg{xaringanthemer} in your slides' source file.} | ||||
| } | } | ||||
| \value{ | |||||
| The value of the xaringanthemer style parameter. | |||||
| } | |||||
| \description{ | \description{ | ||||
| A helper function to retrieve the value of style settings as set by a | A helper function to retrieve the value of style settings as set by a | ||||
| xaringanthemer style function, for use in plotting and other circumstances. | xaringanthemer style function, for use in plotting and other circumstances. |
| solarized_dark(...) | solarized_dark(...) | ||||
| } | } | ||||
| \arguments{ | |||||
| \item{...}{Argumets passed to the new or renamed functions.} | |||||
| } | |||||
| \value{ | |||||
| The result of the new or renamed function. | |||||
| } | |||||
| \description{ | \description{ | ||||
| These functions in xaringanthemer have been deprecated or renamed. | These functions in xaringanthemer have been deprecated or renamed. | ||||