Provide palettes as functions
Change-Id: Idc93e5c4538233ceaf248530e98a20cdcac38764
diff --git a/R/highcharter-themes.R b/R/highcharter-themes.R
index 9030d90..f934f43 100644
--- a/R/highcharter-themes.R
+++ b/R/highcharter-themes.R
@@ -44,7 +44,7 @@
textColor = textColorDark,
lowContrastColor = lowContrastColorDark,
highContrastColor = highContrastColorDark,
- palette = idsPalette,
+ palette = idsPalette(),
backgroundColor = list(linearGradient = list(
x1 = 0,
y1 = 1,
diff --git a/R/idsThemeR.R b/R/idsThemeR.R
index bfab33a..6693c96 100644
--- a/R/idsThemeR.R
+++ b/R/idsThemeR.R
@@ -1,6 +1,14 @@
idsBaseFontFamily <- 'Fira Sans Condensed'
-idsPalette <- c(
+
+#' Title
+#'
+#' @return
+#' @export
+#'
+#' @examples
+idsPalette <- function() {
+ c(
'#F18700',
"#1E2662",
"#6A7702",
@@ -22,8 +30,16 @@
"#DF9599",
"#79B8DB"
)
+}
-idsPaletteD3 <- c(
+#' Title
+#'
+#' @return
+#' @export
+#'
+#' @examples
+idsPaletteD3 <- function() {
+ c(
'#EB7C31',
"#1F77B4",
"#2CA02C",
@@ -45,10 +61,19 @@
"#DBDB8D",
"#9EDAE5"
)
+}
-idsPaletteGreyscale <- c(
+#' Title
+#'
+#' @return
+#' @export
+#'
+#' @examples
+idsPaletteGreyscale <- function() {
+ c(
"#000000", "#B2B0AD", "#737373", "#D8D7D6", "#B2B0AD", "#8C8984"
-)
+ )
+}
backgroundColorDark <- "#2a2a2a"
textColorDark <- "#E0E0E3"
@@ -78,7 +103,7 @@
#' \url{https://github.com/d3/d3}
#'
ids_pal <- function(palette="default") {
- values <- if(palette == "d3" || palette == "D3") idsPaletteD3 else idsPalette
+ values <- if(palette == "d3" || palette == "D3") idsPaletteD3() else idsPalette()
f <- scales::manual_pal(values)
attr(f, "max_n") <- length(values)
f