R/theme-monokai.R

Defines functions hc_theme_monokai

Documented in hc_theme_monokai

#' Monokai theme for highcharts
#'
#' Monokai is a well know text editor theme.
#'
#' @param ... A named parameters to modify the theme.
#'
#' @examples
#'
#' highcharts_demo() %>%
#'   hc_add_theme(hc_theme_monokai())
#' @export
hc_theme_monokai <- function(...) {
  theme <-
    hc_theme(
      colors = c("#F92672", "#66D9EF", "#A6E22E", "#A6E22E"),
      chart = list(
        backgroundColor = "#272822",
        style = list(
          fontFamily = "Inconsolata",
          color = "#A2A39C"
        )
      ),
      title = list(
        style = list(
          color = "#A2A39C"
        ),
        align = "left"
      ),
      subtitle = list(
        style = list(
          color = "#A2A39C"
        ),
        align = "left"
      ),
      legend = list(
        align = "right",
        verticalAlign = "bottom",
        itemStyle = list(
          fontWeight = "normal",
          color = "#A2A39C"
        )
      ),
      xAxis = list(
        gridLineDashStyle = "Dot",
        gridLineWidth = 1,
        gridLineColor = "#A2A39C",
        lineColor = "#A2A39C",
        minorGridLineColor = "#A2A39C",
        tickColor = "#A2A39C",
        tickWidth = 1
      ),
      yAxis = list(
        gridLineDashStyle = "Dot",
        gridLineColor = "#A2A39C",
        lineColor = "#A2A39C",
        minorGridLineColor = "#A2A39C",
        tickColor = "#A2A39C",
        tickWidth = 1
      )
    )

  theme <- structure(theme, class = "hc_theme")

  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.