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

Detect presence of {showtext} as default of `use_showtext` (#56)

Updates color examples and adds left-column headings demo to skeleton
tags/v0.4.0
Garrick Aden-Buie 5 лет назад
Родитель
Сommit
b9bea9db0d
Аккаунт пользователя с таким Email не найден
8 измененных файлов: 72 добавлений и 22 удалений
  1. +3
    -0
      NEWS.md
  2. +9
    -5
      R/ggplot2.R
  3. +6
    -2
      R/zzz.R
  4. +2
    -0
      inst/rmarkdown/templates/xaringanthemer/skeleton/.gitignore
  5. +40
    -6
      inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd
  6. +4
    -3
      man/theme_xaringan.Rd
  7. +4
    -3
      man/theme_xaringan_base.Rd
  8. +4
    -3
      man/theme_xaringan_inverse.Rd

+ 3
- 0
NEWS.md Просмотреть файл



* Set slide number font size in `rem` so that increasing the font size at the * Set slide number font size in `rem` so that increasing the font size at the
slide level doesn't result in giant slide numbers (#53). slide level doesn't result in giant slide numbers (#53).
* xaringanthemer no longer sets the `fig.showtext` chunk option when the
showtext package isn't installed (#56).


# xaringanthemes 0.3.4 # xaringanthemes 0.3.4



+ 9
- 5
R/ggplot2.R Просмотреть файл

title_font = NULL, title_font = NULL,
title_font_use_google = NULL, title_font_use_google = NULL,
title_font_size = NULL, title_font_size = NULL,
use_showtext = TRUE
use_showtext = NULL
) { ) {
requires_xaringanthemer_env(css_file = css_file, try_css = TRUE) requires_xaringanthemer_env(css_file = css_file, try_css = TRUE)
requires_package(fn = "xaringan_theme") requires_package(fn = "xaringan_theme")
title_font = NULL, title_font = NULL,
title_font_use_google = NULL, title_font_use_google = NULL,
title_font_size = NULL, title_font_size = NULL,
use_showtext = TRUE
use_showtext = NULL
) { ) {
requires_xaringanthemer_env(css_file = css_file, try_css = TRUE) requires_xaringanthemer_env(css_file = css_file, try_css = TRUE)
requires_package(fn = "xaringan_theme") requires_package(fn = "xaringan_theme")
#' Fonts](https://fonts.google.com)? #' Fonts](https://fonts.google.com)?
#' @param title_font_size Base text font size, inherits from `title_font_size`, #' @param title_font_size Base text font size, inherits from `title_font_size`,
#' or defaults to 14. #' or defaults to 14.
#' @param use_showtext If `TRUE` (default) the \pkg{showtext} package will be
#' @param use_showtext If `TRUE` the \pkg{showtext} package will be
#' used to register Google fonts. Set to `FALSE` to disable this feature #' used to register Google fonts. Set to `FALSE` to disable this feature
#' entirely, which may result in errors during plotting if the fonts used are #' entirely, which may result in errors during plotting if the fonts used are
#' not available locally.
#' not available locally. The default is `TRUE` when the \pkg{showtext}
#' package is installed.
#' @param ... Ignored #' @param ... Ignored
#' #'
#' @examples #' @examples
title_font = NULL, title_font = NULL,
title_font_use_google = NULL, title_font_use_google = NULL,
title_font_size = NULL, title_font_size = NULL,
use_showtext = TRUE
use_showtext = NULL
) { ) {
text_color <- full_length_hex(text_color) text_color <- full_length_hex(text_color)
background_color <- full_length_hex(background_color) background_color <- full_length_hex(background_color)
text_font_use_google <- text_font_use_google %||% is_google_font(text_font) text_font_use_google <- text_font_use_google %||% is_google_font(text_font)
title_font_use_google <- title_font_use_google %||% is_google_font(title_font) title_font_use_google <- title_font_use_google %||% is_google_font(title_font)


if (is.null(use_showtext)) {
use_showtext <- requires_package("showtext", "theme_xaringan", required = FALSE)
}
text_font <- if (!is.null(text_font)) { text_font <- if (!is.null(text_font)) {
register_font(text_font, identical(text_font_use_google, TRUE) && use_showtext) register_font(text_font, identical(text_font_use_google, TRUE) && use_showtext)
} else { } else {

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

.onLoad <- function(libname, pkgname, ...) { .onLoad <- function(libname, pkgname, ...) {


if ("knitr" %in% loadedNamespaces()) { if ("knitr" %in% loadedNamespaces()) {
knitr::opts_chunk$set(fig.showtext = TRUE)
if (requireNamespace("showtext", quietly = TRUE)) {
knitr::opts_chunk$set(fig.showtext = TRUE)
}
} }


setHook( setHook(
packageEvent("knitr", "onLoad"), packageEvent("knitr", "onLoad"),
function(...) { function(...) {
knitr::opts_chunk$set(fig.showtext = TRUE)
if (requireNamespace("showtext", quietly = TRUE)) {
knitr::opts_chunk$set(fig.showtext = TRUE)
}
} }
) )



+ 2
- 0
inst/rmarkdown/templates/xaringanthemer/skeleton/.gitignore Просмотреть файл

*
!skeleton.Rmd

+ 40
- 6
inst/rmarkdown/templates/xaringanthemer/skeleton/skeleton.Rmd Просмотреть файл

echo = TRUE, echo = TRUE,
message = FALSE, message = FALSE,
warning = FALSE, warning = FALSE,
fig.showtext = requireNamespace("showtext", quietly = TRUE),
hiline = TRUE hiline = TRUE
) )
``` ```


## Colors ## Colors


- <span style="color: var(--text-color)">Text Color</span>
.left-column[
Text color


- <span style="color: var(--header-color); font-family: var(--header-font-family);">Header Color</span>
[Link Color](#3)


- <span style="color: var(--link-color)">Link Color</span>
**Bold Color**


- <span style="color: var(--text-bold-color); font-weight: bold;">Bold Color</span>
_Italic Color_


- `inline code color`
`Inline Code`
]

.right-column[
Lorem ipsum dolor sit amet, [consectetur adipiscing elit (link)](#3),
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Erat nam at lectus urna.
Pellentesque elit ullamcorper **dignissim cras tincidunt (bold)** lobortis feugiat.
_Eros donec ac odio tempor_ orci dapibus ultrices.
Id porta nibh venenatis cras sed felis eget velit aliquet.
Aliquam id diam maecenas ultricies mi.
Enim sit amet
`code_color("inline")`
venenatis urna cursus eget nunc scelerisque viverra.
]


--- ---




###### Definitely don't use h6 `######` ###### Definitely don't use h6 `######`


---

# Left-Column Headings

.left-column[
## First

## Second

## Third
]

.right-column[
Dolor quis aptent mus a dictum ultricies egestas.

Amet egestas neque tempor fermentum proin massa!

Dolor elementum fermentum pharetra lectus arcu pulvinar.
]

--- ---
class: inverse center middle class: inverse center middle



+ 4
- 3
man/theme_xaringan.Rd Просмотреть файл

title_font = NULL, title_font = NULL,
title_font_use_google = NULL, title_font_use_google = NULL,
title_font_size = NULL, title_font_size = NULL,
use_showtext = TRUE
use_showtext = NULL
) )
} }
\arguments{ \arguments{
\item{title_font_size}{Base text font size, inherits from \code{title_font_size}, \item{title_font_size}{Base text font size, inherits from \code{title_font_size},
or defaults to 14.} or defaults to 14.}


\item{use_showtext}{If \code{TRUE} (default) the \pkg{showtext} package will be
\item{use_showtext}{If \code{TRUE} the \pkg{showtext} package will be
used to register Google fonts. Set to \code{FALSE} to disable this feature used to register Google fonts. Set to \code{FALSE} to disable this feature
entirely, which may result in errors during plotting if the fonts used are entirely, which may result in errors during plotting if the fonts used are
not available locally.}
not available locally. The default is \code{TRUE} when the \pkg{showtext}
package is installed.}
} }
\value{ \value{
A ggplot2 theme A ggplot2 theme

+ 4
- 3
man/theme_xaringan_base.Rd Просмотреть файл

title_font = NULL, title_font = NULL,
title_font_use_google = NULL, title_font_use_google = NULL,
title_font_size = NULL, title_font_size = NULL,
use_showtext = TRUE
use_showtext = NULL
) )
} }
\arguments{ \arguments{
\item{title_font_size}{Base text font size, inherits from \code{title_font_size}, \item{title_font_size}{Base text font size, inherits from \code{title_font_size},
or defaults to 14.} or defaults to 14.}


\item{use_showtext}{If \code{TRUE} (default) the \pkg{showtext} package will be
\item{use_showtext}{If \code{TRUE} the \pkg{showtext} package will be
used to register Google fonts. Set to \code{FALSE} to disable this feature used to register Google fonts. Set to \code{FALSE} to disable this feature
entirely, which may result in errors during plotting if the fonts used are entirely, which may result in errors during plotting if the fonts used are
not available locally.}
not available locally. The default is \code{TRUE} when the \pkg{showtext}
package is installed.}
} }
\value{ \value{
A ggplot2 theme A ggplot2 theme

+ 4
- 3
man/theme_xaringan_inverse.Rd Просмотреть файл

title_font = NULL, title_font = NULL,
title_font_use_google = NULL, title_font_use_google = NULL,
title_font_size = NULL, title_font_size = NULL,
use_showtext = TRUE
use_showtext = NULL
) )
} }
\arguments{ \arguments{
\item{title_font_size}{Base text font size, inherits from \code{title_font_size}, \item{title_font_size}{Base text font size, inherits from \code{title_font_size},
or defaults to 14.} or defaults to 14.}


\item{use_showtext}{If \code{TRUE} (default) the \pkg{showtext} package will be
\item{use_showtext}{If \code{TRUE} the \pkg{showtext} package will be
used to register Google fonts. Set to \code{FALSE} to disable this feature used to register Google fonts. Set to \code{FALSE} to disable this feature
entirely, which may result in errors during plotting if the fonts used are entirely, which may result in errors during plotting if the fonts used are
not available locally.}
not available locally. The default is \code{TRUE} when the \pkg{showtext}
package is installed.}
} }
\value{ \value{
A ggplot2 theme A ggplot2 theme

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