-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathggthemr_current.R
46 lines (40 loc) · 1 KB
/
ggthemr_current.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
themr <- NULL
#' @title Store Theme
#' @description Store ggthemr theme.
#' @importFrom utils assignInMyNamespace
ggthemr_current <- (function () {
list(
get = function () {
if (is.null(themr)) {
stop('ggthemr theme has not been set yet.', call.=FALSE)
} else {
return (themr)
}
},
set = function (value) {
verify_ggthemr(value)
assignInMyNamespace('themr', value)
# themr <<- value
},
is_set = function () {
!is.null(themr)
},
clear = function () {
assignInMyNamespace('themr', NULL)
# themr <<- NULL
}
)
})()
#' @title Get Current Theme
#' @description Get the current ggthemr theme.
get_themr <- function ()
ggthemr_current$get()
#' @title Set Current Theme
#' @description Set the current ggthemr theme.
#' @param value ggthemr object.
set_themr <- function (value)
ggthemr_current$set(value)
is_ggthemr_active <- function ()
ggthemr_current$is_set()
clear_themr <- function ()
ggthemr_current$clear()