Use adapted D3 palette as default
... instead of IDS department colours, which could be misleading.
Also add "poly20" palette and make "grey" palette usable from for ggplot2
Change-Id: Ic31cb5ecf881e232d3fc9209b63b19b8705a40b8
diff --git a/R/idsThemeR.R b/R/idsThemeR.R
index 6693c96..0465942 100644
--- a/R/idsThemeR.R
+++ b/R/idsThemeR.R
@@ -7,7 +7,7 @@
#' @export
#'
#' @examples
-idsPalette <- function() {
+idsPaletteIDS <- function() {
c(
'#F18700',
"#1E2662",
@@ -69,12 +69,35 @@
#' @export
#'
#' @examples
+idsPalettePoly20 <- function() {
+ c(
+ "#EF8700", "#1642FF", "#00D20D", "#FF00CB", "#162E35", "#00C8FC", "#FF004B", "#BBB96A", "#DFA2ED", "#881640", "#22D0AD", "#CF0DF7",
+ "#2E0D95", "#AFB9BD", "#FC4792", "#EBA392", "#1C7C00", "#939CFF", "#AB00A4", "#AF1C00"
+ )
+}
+
+#' Title
+#'
+#' @return
+#' @export
+#'
+#' @examples
idsPaletteGreyscale <- function() {
c(
"#000000", "#B2B0AD", "#737373", "#D8D7D6", "#B2B0AD", "#8C8984"
)
}
+#' Title
+#'
+#' @return
+#' @export
+#'
+#' @examples
+idsPalette <- function() {
+ idsPaletteD3()
+}
+
backgroundColorDark <- "#2a2a2a"
textColorDark <- "#E0E0E3"
lowContrastColorDark <- "#707073"
@@ -93,7 +116,7 @@
#' IDS color palette
#'
-#' @param palette \code{c("D3", "default")} - use default or (adapted) d3 palette
+#' @param palette \code{c("d3", "grey", "ids", "poly20")} - default: (adapted) d3 palette
#'
#' @importFrom scales manual_pal
#' @export
@@ -103,7 +126,13 @@
#' \url{https://github.com/d3/d3}
#'
ids_pal <- function(palette="default") {
- values <- if(palette == "d3" || palette == "D3") idsPaletteD3() else idsPalette()
+ values <- switch(tolower(palette),
+ ids = idsPalette(),
+ gray = idsPaletteGreyscale(),
+ grey = idsPaletteGreyscale(),
+ poly20 = idsPalettePoly20(),
+ idsPaletteD3()
+ )
f <- scales::manual_pal(values)
attr(f, "max_n") <- length(values)
f