#' IDS Theme for ggplot2
#'
#' Based on Highcharts ggtheme \link[ggthemes]{theme_hc}
#' which again is based on the plots in \url{Highcharts JS}.
#'
#' @note
#'
#' Note that here, unlike with the highcharter theme, you have to set the scale
#' explicitly.
#'
#'
#' @references
#'
#' \link[ggthemes]{theme_hc}
#'
#' \url{http://www.highcharts.com/demo/line-basic}
#'
#' \url{https://github.com/highslide-software/highcharts.com/tree/master/js/themes}
#'
#' @inheritParams ggplot2::theme_bw
#' @param style \code{'light'}, \code{'dark'}.
#' @param bgcolor Deprecated
#' @example inst/examples/ex-ggplot.R
#' @family themes ids
#' @importFrom ggplot2 theme element_rect element_text element_line element_blank
#' @export
theme_ids <- function(base_size = 10,
                     base_family = idsBaseFontFamily,
                     style = c("default", "light", "dark"),
                     bgcolor = NULL) {

  if (!is.null(bgcolor)) {
    warning("`bgcolor` is deprecated. Use `style` instead.")
    style <- bgcolor
  }
  style <- match.arg(style)
  bgcolor <- switch(style,
                    default = backgroundColor,
                    "light" = backgroundColor,
                    "mono" = backgroundColor,
                    "dark" = backgroundColorDark)

  ret <- theme(rect = element_rect(fill = bgcolor, linetype = 0, colour = NA),
               text = element_text(size = base_size * 0.8, family = base_family),
               plot.title = element_text(hjust = 0.5),
               plot.subtitle = element_text(hjust = 0.5, size = base_size * 0.9, colour = mediumContrastColor),
               title = element_text(hjust = 0.5),
               axis.text = element_text(size = base_size * 1.0, family = base_family),
               axis.title = element_text(size = base_size * 1.0, family = base_family),
               legend.title = element_text(size = base_size * 1.0, family = base_family, colour = mediumContrastColor),
               legend.text = element_text(size = base_size * 1.0, family = base_family),
               strip.text =  element_text(size = base_size * 1.0, family = base_family),
               axis.title.x = element_text(hjust = 0.5, size = base_size * 1.0,
                                           colour = mediumContrastColor),
               axis.title.y = element_text(hjust = 0.5, size = base_size * 1.0,
                                           margin = margin(r = 10),
                                           colour = mediumContrastColor),
               panel.grid.major.x = element_line(linetype = "dotted", colour = lowContrastColor),
               panel.grid.major.y = element_line(colour = lowContrastColor),
               panel.grid.minor.y = element_blank(),
               panel.grid.minor.x = element_blank(),
               panel.border = element_blank(),
               panel.background = element_blank(),
               legend.position = "right",
               legend.key = element_rect(fill = paste0(bgcolor,"00")))

  if (style == "dark") {
    ret <- (ret + theme(rect = element_rect(fill = bgcolor),
                        text = element_text(colour = textColorDark),
                        plot.title = element_text(colour = highContrastColorDark),
                        plot.subtitle = element_text(colour = mediumContrastColorDark),
                        axis.title.x = element_text(colour = textColorDark),
                        axis.title.y = element_text(colour = textColorDark),
                        axis.text.x = element_text(color=textColorDark),
                        axis.text.y = element_text(color=textColorDark),
                        panel.grid.major.y = element_line(colour = lowContrastColorDark),
                        legend.title = element_text(colour = textColorDark)))
  }
  update_geom_defaults("text", list(size = 3, family = base_family))
  ret

}


#' IDS color and fill scales
#'
#' Colour and fill scales which use the palettes in
#' \code{\link{ids_pal}()} and are meant for use with
#' \code{\link{theme_ids}()}.
#'
#' @param palette A palette function that when called with a single integer
#' argument (the number of levels in the scale) returns the values that they should take.
#'
#' @importFrom ggthemes gdocs_pal
#' @importFrom ggplot2 discrete_scale
#'
#' @inheritDotParams  ggthemes::scale_colour_gdocs
#' @family colour ids
#' @rdname scale_ids
#' @export
scale_colour_ids <- function(palette = "default", ...) {
  discrete_scale("colour", "ids", ids_pal(palette=palette, ...))
}

#' @rdname scale_ids
#' @inheritDotParams  ggthemes::scale_colour_gdocs
#' @importFrom ggplot2 discrete_scale
#' @export
scale_color_ids <- scale_colour_ids

#' @rdname scale_ids
#' @inheritParams ggthemes::scale_fill_gdocs
#' @importFrom ggplot2 discrete_scale
#' @export
scale_fill_ids <- function(palette = "default", ...) {
  discrete_scale("fill", "ids", ids_pal(palette=palette, ...))
}
