-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathzzz.R
56 lines (50 loc) · 1.69 KB
/
zzz.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
47
48
49
50
51
52
53
54
# .onAttach <- function(libname, pkgname) {
#
# bsu_rule_color <- "#2c3e50"
# bsu_main_color <- "#1f78b4"
#
# # Check Theme: If Dark, Update Colors
# tryCatch({
# if (rstudioapi::isAvailable()) {
# theme <- rstudioapi::getThemeInfo()
# if (is.null(theme)) {
# bsu_rule_color <- "#2c3e50"
# bsu_main_color <- "#1f78b4"
# }
# if (theme$dark) {
# bsu_rule_color <- "#7FD2FF"
# bsu_main_color <- "#18bc9c"
# }
# }
# }, error = function(e) {
# bsu_rule_color <- "#2c3e50"
# bsu_main_color <- "#1f78b4"
# }, finally = {
# bsu_main <- crayon::make_style(bsu_main_color)
#
# msg <- paste0(
# cli::rule(left = "Need to Learn tidyquant?", col = bsu_rule_color, line = 2),
# bsu_main('\nBusiness Science offers a 1-hour course - Learning Lab #9: Performance Analysis & Portfolio Optimization with tidyquant!\n'),
# bsu_main('</> Learn more at: https://university.business-science.io/p/learning-labs-pro </>')
# )
#
# packageStartupMessage(msg)
# })
#
# }
.onAttach <- function(...) {
attached <- tidyquant_attach()
if (!is_loading_for_tests()) {
inform_startup(tidyquant_attach_message(attached))
}
if (!is_attached("conflicted") && !is_loading_for_tests()) {
conflicts <- tidyquant_conflicts()
inform_startup(tidyquant_conflict_message(conflicts))
}
}
is_attached <- function(x) {
paste0("package:", x) %in% search()
}
is_loading_for_tests <- function() {
!interactive() && identical(Sys.getenv("DEVTOOLS_LOAD"), "tidyquant")
}