Provide palettes as functions
Change-Id: Idc93e5c4538233ceaf248530e98a20cdcac38764
diff --git a/NAMESPACE b/NAMESPACE
index f3d776b..e97eb00 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -3,6 +3,9 @@
export(hc_theme_ids_dark)
export(hc_theme_ids_light)
export(hc_theme_ids_mono)
+export(idsPalette)
+export(idsPaletteD3)
+export(idsPaletteGreyscale)
export(ids_pal)
export(scale_color_ids)
export(scale_colour_ids)
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
diff --git a/man/hc_theme_ids_dark.Rd b/man/hc_theme_ids_dark.Rd
index 162a64c..5eeb3ea 100644
--- a/man/hc_theme_ids_dark.Rd
+++ b/man/hc_theme_ids_dark.Rd
@@ -10,7 +10,7 @@
textColor = textColorDark,
lowContrastColor = lowContrastColorDark,
highContrastColor = highContrastColorDark,
- palette = idsPalette,
+ palette = idsPalette(),
backgroundColor = list(linearGradient = list(x1 = 0, y1 = 1, x2 = 1, y2 = 0), stops =
list(list(0, "#2a2a2b"), list(1, "#3e3e3e"))),
titleColor = textColor,