R/theme-flatdark.R

Defines functions hc_theme_flatdark

Documented in hc_theme_flatdark

#' Flatdark theme for highcharts
#'
#' @param ... A named parameters to modify the theme.
#'
#' @examples
#'
#' highcharts_demo() %>%
#'   hc_add_theme(hc_theme_flatdark())
#' @export
hc_theme_flatdark <- function(...) {
  theme <- hc_theme_flat(
    chart = list(
      backgroundColor = "#34495e"
    ),
    xAxis = list(
      gridLineColor = "#46627f",
      tickColor = "#46627f",
      lineColor = "#46627f",
      title = list(
        style = list(
          color = "#FFFFFF"
        )
      )
    ),
    yAxis = list(
      gridLineColor = "#46627f",
      tickColor = "#46627f",
      title = list(
        style = list(
          color = "#FFFFFF"
        )
      )
    ),
    title = list(
      style = list(
        color = "#FFFFFF"
      )
    ),
    subtitle = list(
      style = list(
        color = "#666666"
      )
    ),
    legend = list(
      itemStyle = list(
        color = "#C0C0C0"
      ),
      itemHoverStyle = list(
        color = "#C0C0C0"
      ),
      itemHiddenStyle = list(
        color = "#444444"
      )
    )
  )

  if (length(list(...)) > 0) {
    theme <- hc_theme_merge(
      theme,
      hc_theme(...)
    )
  }

  theme
}

Try the highcharter package in your browser

Any scripts or data that you put into this service are public.

highcharter documentation built on Jan. 3, 2022, 5:08 p.m.