Use proper IDS CD default palette and bump to v0.3.0
Thanks @Sascha!
Change-Id: If0ba7262141dbf0b257dbc3288a615bca4c70455
diff --git a/R/ggplot-theme.R b/R/ggplot-theme.R
index fb3176b..0f6aabe 100644
--- a/R/ggplot-theme.R
+++ b/R/ggplot-theme.R
@@ -90,7 +90,7 @@
#' @rdname scale_ids
#' @export
scale_colour_ids <- function(palette = "default", ...) {
- discrete_scale("colour", "ids", ids_pal(), ...)
+ discrete_scale("colour", "ids", ids_pal(palette=palette, ...))
}
#' @rdname scale_ids
@@ -104,5 +104,5 @@
#' @importFrom ggplot2 discrete_scale
#' @export
scale_fill_ids <- function(palette = "default", ...) {
- discrete_scale("fill", "ids", ids_pal(), ...)
+ discrete_scale("fill", "ids", ids_pal(palette=palette, ...))
}
diff --git a/R/idsThemeR.R b/R/idsThemeR.R
index d62f03c..bfab33a 100644
--- a/R/idsThemeR.R
+++ b/R/idsThemeR.R
@@ -1,6 +1,29 @@
idsBaseFontFamily <- 'Fira Sans Condensed'
idsPalette <- c(
+ '#F18700',
+ "#1E2662",
+ "#6A7702",
+ "#C10A25",
+ "#009EE3",
+ "#FAF3DE",
+ "#A7C2D2",
+ "#E2E8A4",
+ "#CFBCBD",
+ "#BCE3FA",
+ "#5C401C",
+ "#000000",
+ "#354C32",
+ "#5C131C",
+ "#273582",
+ "#FFE3BF",
+ "#8994E1",
+ "#A3B29E",
+ "#DF9599",
+ "#79B8DB"
+)
+
+idsPaletteD3 <- c(
'#EB7C31',
"#1F77B4",
"#2CA02C",
@@ -43,7 +66,9 @@
candlestickColor <- "black"
errorbarColor <- "black"
-#' IDS color palette based on the d3 color palette
+#' IDS color palette
+#'
+#' @param palette \code{c("D3", "default")} - use default or (adapted) d3 palette
#'
#' @importFrom scales manual_pal
#' @export
@@ -52,8 +77,8 @@
#'
#' \url{https://github.com/d3/d3}
#'
-ids_pal <- function() {
- values <- idsPalette
+ids_pal <- function(palette="default") {
+ values <- if(palette == "d3" || palette == "D3") idsPaletteD3 else idsPalette
f <- scales::manual_pal(values)
attr(f, "max_n") <- length(values)
f