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

Fill in documentation for utils

tags/v0.1.1
Garrick Aden-Buie 8 лет назад
Родитель
Сommit
a790290027
3 измененных файлов: 25 добавлений и 11 удалений
  1. +11
    -6
      R/utils.R
  2. +5
    -0
      man/apply_alpha.Rd
  3. +9
    -5
      man/google_language_codes.Rd

+ 11
- 6
R/utils.R Просмотреть файл

@@ -27,6 +27,9 @@ darken_color <- function(color_hex, strength = 0.8) {
}

#' @title Add alpha to hex color
#' @description Applies alpha (or opacity) to a color in hexadecimal form by
#' converting opacity in the [0, 1] range to hex in the [0, 255] range
#' and appending to the hex color.
#' @inheritParams lighten_darken_color
#' @param opacity Desired opacity of the output color
#' @export
@@ -105,16 +108,18 @@ google_font <- function(family, ..., languages = NULL) {
}

#' @title List Valid Google Language Codes
#' @description Gives a list of valid Language Codes for Google Fonts, or
#' validates that the language codes given are valid.
#' @seealso [google_font()]
#' @param x Vector of potential Google language codes
#' @param language_codes Vector of potential Google language codes
#' @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")
language_codes = 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))
unique(match.arg(language_codes, several.ok = TRUE))
}

print.google_font <- function(x) {

+ 5
- 0
man/apply_alpha.Rd Просмотреть файл

@@ -11,3 +11,8 @@ apply_alpha(color_hex, opacity = 0.5)

\item{opacity}{Desired opacity of the output color}
}
\description{
Applies alpha (or opacity) to a color in hexadecimal form by
converting opacity in the \link{0, 1} range to hex in the \link{0, 255} range
and appending to the hex color.
}

+ 9
- 5
man/google_language_codes.Rd Просмотреть файл

@@ -4,13 +4,17 @@
\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"))
google_language_codes(language_codes = 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}
\item{language_codes}{Vector of potential Google language codes}
}
\description{
Gives a list of valid Language Codes for Google Fonts, or
validates that the language codes given are valid.
}
\seealso{
\code{\link[=google_font]{google_font()}}

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