From 654345d019f285c36ed4eb0a20ddc00124299ff7 Mon Sep 17 00:00:00 2001 From: Pascal Burkhard Date: Mon, 18 Nov 2024 23:10:14 +0100 Subject: [PATCH] feat: add hc_dark_web_theme --- NAMESPACE | 1 + R/highcharter_themes.R | 72 ++++++++++++++++++++++++++++++++++++++++++ man/hc_purple_theme.Rd | 3 ++ 3 files changed, 76 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 9ac6f62..fe4805b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -23,6 +23,7 @@ export(ggeopal_pal_to_gradient) export(ggeopal_to_gradient) export(ggeosave) export(ggeotheme) +export(hc_dark_web_theme) export(hc_jerusalem_theme) export(hc_pomogreen_theme) export(hc_purple_theme) diff --git a/R/highcharter_themes.R b/R/highcharter_themes.R index c25d395..8d2b356 100644 --- a/R/highcharter_themes.R +++ b/R/highcharter_themes.R @@ -427,3 +427,75 @@ hc_web_theme <- function(hc) { hc |> highcharter::hc_add_theme(theme) } + +#' @rdname hc_purple_theme +#' @export +hc_dark_web_theme <- function(hc) { + base_colors <- list( + main_color = "#acb5c9", + axis_color = "#b7caed", + title_color = "#ffffff" + ) + + base_text_style <- list( + fontFamily = "Fira Sans", + color = base_colors$main_color + ) + + axis_title_style <- list( + fontFamily = "Fira Sans", + color = base_colors$axis_color + ) + + theme <- highcharter::hc_theme( + colors = wesanderson::wes_palette("GrandBudapest2"), + chart = list( + backgroundColor = "transparent" + ), + title = list( + style = list( + color = base_colors$title_color, + fontFamily = "Fira Sans" + ) + ), + subtitle = list( + style = list( + color = base_colors$title_color, + fontFamily = "Fira Sans" + ) + ), + legend = list( + itemStyle = base_text_style, + itemHoverStyle = list( + color = base_colors$main_color + ) + ), + tooltip = list( + style = list( + fontFamily = "Fira Sans" + ) + ), + caption = list( + style = base_text_style + ), + xAxis = list( + labels = list( + style = base_text_style + ), + title = list( + style = axis_title_style + ) + ), + yAxis = list( + labels = list( + style = base_text_style + ), + title = list( + style = axis_title_style + ) + ) + ) + + hc |> + highcharter::hc_add_theme(theme) +} diff --git a/man/hc_purple_theme.Rd b/man/hc_purple_theme.Rd index daf4b0b..cc07f61 100644 --- a/man/hc_purple_theme.Rd +++ b/man/hc_purple_theme.Rd @@ -6,6 +6,7 @@ \alias{hc_pomogreen_theme} \alias{hc_jerusalem_theme} \alias{hc_web_theme} +\alias{hc_dark_web_theme} \title{Highcharts themes} \usage{ hc_purple_theme(hc) @@ -17,6 +18,8 @@ hc_pomogreen_theme(hc) hc_jerusalem_theme(hc) hc_web_theme(hc) + +hc_dark_web_theme(hc) } \arguments{ \item{hc}{A highcharts object}