Initial import

Change-Id: I59748a78b35a3e14013333912966971a02dd19b4
diff --git a/R/highcharter-themes.R b/R/highcharter-themes.R
new file mode 100644
index 0000000..7cafeb2
--- /dev/null
+++ b/R/highcharter-themes.R
@@ -0,0 +1,287 @@
+#' Dark IDS theme for \link[highcharter]{highcharter}
+#'
+#' @param fontFamily              font family        
+#' @param fontSize                default font size
+#' @param textColor               default text color
+#' @param lowContrastColor        color with low contrast to background 
+#' @param highContrastColor       color with high contrast to background 
+#' @param palette                 array of colors to be used for different series 
+#' @param backgroundColor         background color
+#' @param titleColor              color of the title text
+#' @param subtitleColor           color of the subtitle text
+#' @param gridLineColor           color of grid lines
+#' @param axisLabelColor          color of the axis labels
+#' @param axisLineColor           color of the axis lines
+#' @param minorGridLineColor      color of minor grid lines
+#' @param tickColor               color of axis ticks
+#' @param axisTitleColor          color of axis titles
+#' @param tooltipBackgroundColor  background color for tool tips
+#' @param tooltipColor            foreground color for tool tips
+#' @param dataLabelColor          color of data point labels
+#' @param boxplotFillColor        color for box plot fills
+#' @param candlestickColor        color the candle stick part of error bars
+#' @param errorbarColor           error bar color
+#' @param legendColor             series legend label color
+#' @param legendHoverColor        mouse over series legend label color
+#' @param legendHiddenColor       hidden series legend label color
+#' @param creditsColor            color of the credits
+#' @param burgerMenuBackground    burger menu background color
+#' @param ... named arguments to modify the theme
+#'
+#' @importFrom magrittr %>%
+#' @import tidyverse
+#' @import highcharter
+#'
+#' @examples
+#' library(tidyverse)
+#' library(highcharter)
+#' highcharts_demo() %>%
+#'   hc_add_theme(hc_theme_ids_dark())
+#' @export
+hc_theme_ids_dark <-
+  function(fontFamily = "Fira Sans Condensed",
+           fontSize = "medium",
+           textColor = "#E0E0E3",
+           lowContrastColor = "#707073",
+           highContrastColor = "#F0F0F3",
+           palette = c(
+             '#EB7C31',
+             "#1F77B4",
+             "#2CA02C",
+             "#D62728",
+             "#9467BD",
+             "#8C564B",
+             "#E377C2",
+             "#7F7F7F",
+             "#BCBD22",
+             "#17BECF",
+             "#AEC7E8",
+             "#FFBB78",
+             "#98DF8A",
+             "#FF9896",
+             "#C5B0D5",
+             "#C49C94",
+             "#F7B6D2",
+             "#C7C7C7",
+             "#DBDB8D",
+             "#9EDAE5"
+           ),
+           backgroundColor = list(linearGradient = list(
+             x1 = 0,
+             y1 = 1,
+             x2 = 1,
+             y2 = 0
+           ),
+           stops = list(list(0, "#2a2a2b"),
+                        list(1, "#3e3e3e"))),
+           titleColor = textColor,
+           subtitleColor = titleColor,
+           gridLineColor = lowContrastColor,
+           axisLabelColor = textColor,
+           axisLineColor = lowContrastColor,
+           minorGridLineColor = "#505053",
+           tickColor = lowContrastColor,
+           axisTitleColor = axisLabelColor,
+           tooltipBackgroundColor = "rgba(0, 0, 0, 0.85)",
+           tooltipColor = textColor,
+           dataLabelColor = textColor,
+           boxplotFillColor = "#505053",
+           candlestickColor = highContrastColor,
+           errorbarColor = candlestickColor,
+           legendColor = textColor,
+           legendHoverColor = highContrastColor,
+           legendHiddenColor = lowContrastColor,
+           creditsColor = lowContrastColor,
+           burgerMenuBackground = backgroundColor,
+           ...) {
+    theme <-
+      list(
+        colors = palette,
+        chart = list(
+          backgroundColor = backgroundColor,
+          style = list(fontFamily = fontFamily,
+                       fontSize = fontSize),
+          plotBorderColor = "#606063"
+        ),
+        title = list(style = list(color = titleColor,
+                                  fontWeight = "600",
+                                  fontSize = "x-large")),
+        subtitle = list(style = list(color = subtitleColor,
+                                     fontSize = "large")),
+        xAxis = list(
+          gridLineColor = gridLineColor,
+          labels = list(style = list(color = axisLabelColor,
+                                     fontSize = "medium")),
+          lineColor = axisLineColor,
+          minorGridLineColor = minorGridLineColor,
+          tickColor = tickColor,
+          title = list(style = list(color = axisTitleColor,
+                                    fontSize = "medium"))
+        ),
+        yAxis = list(
+          gridLineColor = gridLineColor,
+          labels = list(style = list(color = axisLabelColor,
+                                     fontSize = "medium")),
+          lineColor = axisLineColor,
+          minorGridLineColor = minorGridLineColor,
+          tickColor = tickColor,
+          tickWidth = 1,
+          title = list(style = list(color = axisTitleColor,
+                                    fontSize = "medium"))
+        ),
+        tooltip = list(
+          backgroundColor = tooltipBackgroundColor,
+          style = list(color = tooltipColor,
+                       fontSize = "medium")
+        ),
+        plotOptions = list(
+          series = list(
+            dataLabels = list(color = dataLabelColor,
+                              fontSize = "medium"),
+            marker = list(lineColor = "#333")
+          ),
+          boxplot = list(fillColor = boxplotFillColor),
+          candlestick = list(lineColor = candlestickColor),
+          errorbar = list(color = errorbarColor)
+        ),
+        legend = list(
+          itemStyle = list(fontSize = "medium",
+                           color = legendColor),
+          itemHoverStyle = list(color = legendHoverColor),
+          itemHiddenStyle = list(color = legendHiddenColor)
+        ),
+        credits = list(style = list(color = creditsColor)),
+        labels = list(style = list(color = "#707073")),
+        
+        drilldown = list(
+          activeAxisLabelStyle = list(color = "#F0F0F3"),
+          activeDataLabelStyle = list(color = "#F0F0F3")
+        ),
+        
+        navigation = list(buttonOptions = list(
+          symbolStroke = "#DDDDDD",
+          theme = list(fill = burgerMenuBackground)
+        )),
+        
+        rangeSelector = list(
+          buttonTheme = list(
+            fill = "#505053",
+            stroke = "#000000",
+            style = list(color = "#CCC"),
+            states = list(
+              hover = list(
+                fill = "#707073",
+                stroke = "#000000",
+                style = list(color = "white")
+              ),
+              select = list(
+                fill = "#000003",
+                stroke = "#000000",
+                style = list(color = "white")
+              )
+            )
+          ),
+          inputBoxBorderColor = "#505053",
+          inputStyle = list(backgroundColor = "#333",
+                            color = "silver"),
+          labelStyle = list(color = "silver")
+        ),
+        
+        navigator = list(
+          handles = list(backgroundColor = "#666",
+                         borderColor = "#AAA"),
+          maskFill = "rgba(255,255,255,0.1)",
+          series = list(color = "#7798BF",
+                        lineColor = "#A6C7ED"),
+          xAxis = list(gridLineColor = "#505053")
+        ),
+        
+        scrollbar = list(
+          barBackgroundColor = "#808083",
+          barBorderColor = "#808083",
+          buttonArrowColor = "#CCC",
+          buttonBackgroundColor = "#606063",
+          buttonBorderColor = "#606063",
+          rifleColor = "#FFF",
+          trackBackgroundColor = "#404043",
+          trackBorderColor = "#404043"
+        ),
+        
+        legendBackgroundColor = "rgba(0, 0, 0, 0)",
+        background2 = "#233238",
+        dataLabelsColor = "#233238",
+        textColor = "#34495e",
+        maskColor = "rgba(255,255,255,0.3)",
+        contrastTextColor = highContrastColor
+      )
+    
+    theme <- structure(theme, class = "hc_theme")
+    
+    if (length(list(...)) > 0) {
+      theme <- hc_theme_merge(theme,
+                              hc_theme(...))
+    }
+    
+    theme
+  }
+
+#' Light IDS theme for \link[highcharter]{highcharter}
+#'
+#' See \code{\link{hc_theme_ids_dark}} for further documentation.
+#'
+#' @param ... named arguments to modify the theme
+#' 
+#' @importFrom magrittr %>%
+#' @import tidyverse
+#' @import highcharter
+#'
+#' @examples
+#' library(tidyverse)
+#' library(highcharter)
+#' highcharts_demo() %>%
+#'   hc_add_theme(hc_theme_ids_light())
+#' @export
+hc_theme_ids_light <- function(...) {
+  hc_theme_ids_dark(
+    backgroundColor = "#ffffff",
+    textColor = "#383838",
+    highContrastColor = "#101013",
+    lowContrastColor = "#E0E0E3",
+    tooltipBackgroundColor = "#ffffffe0",
+    boxplotFillColor = "#505053",
+    candlestickColor = "black",
+    errorbarColor = "black"
+  )
+}
+
+#' Monochrome IDS theme for \link[highcharter]{highcharter}
+#'
+#' See \code{\link{hc_theme_ids_dark}} for further documentation.
+#'
+#' @param ... named arguments to modify the theme
+#' 
+#' @importFrom magrittr %>%
+#' @import tidyverse
+#' @import highcharter
+#'
+#' @examples
+#' library(tidyverse)
+#' library(highcharter)
+#' highcharts_demo() %>%
+#'   hc_add_theme(hc_theme_ids_mono())
+#' @export
+hc_theme_ids_mono <- function(...) {
+  hc_theme_ids_dark(
+    palette = c(
+      "#000000", "#B2B0AD", "#737373", "#D8D7D6", "#B2B0AD", "#8C8984"
+    ),
+    backgroundColor = "white",
+    textColor = "black",
+    highContrastColor = "black",
+    lowContrastColor = "#A0A0A3",
+    tooltipBackgroundColor = "white",
+    boxplotFillColor = "#505053",
+    candlestickColor = "grey",
+    errorbarColor = "grey"
+  )
+}