Get the currently active theme

Description

Returns the name of the tinytheme that is currently in effect. Handy for saving a theme and restoring it later, or for querying the active theme programmatically.

Usage

tinytheme_get()

Details

A thin convenience wrapper around the “tinytheme” entry of tpar. The difference is that it always returns a plain character string, including in a session where no theme has been set yet (where tpar(“tinytheme”) returns NULL rather than “default”). Use tpar if you want the full set of underlying theme settings, rather than just the name.

Note that a theme passed to the tinyplot(…, theme =) argument is ephemeral: it is reset on exit, so it is only visible to tinytheme_get() from inside that same call (e.g. via draw).

Value

A character string naming the active theme.

See Also

tinytheme, tinytheme_register, tpar

Examples

library("tinyplot")

# no theme set yet
tinytheme_get()
[1] "default"
# save the current theme, switch, then restore it afterwards
otheme = tinytheme_get()
tinytheme("classic")
tinytheme_get()
[1] "classic"
tinyplot(mpg ~ wt, data = mtcars)

tinytheme(otheme) # back to where we started
tinytheme_get()
[1] "default"