blob: 6038f845d2ce8260d618a155c55e32d54505e24e [file] [log] [blame]
#' 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 = textColorDark,
lowContrastColor = lowContrastColorDark,
highContrastColor = highContrastColorDark,
palette = idsPalette(),
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,
gridLineDashStyle = "ShortDot",
gridLineWidth = 1,
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",
fontWeight="normal",
opacity="100%",
color = highContrastColor),
itemHoverStyle = list(
fontSize = "large"
),
itemHiddenStyle = list(opacity="40%", fillColor="inherit", color="inherit")
),
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.
#'
#' @inheritParams hc_theme_ids_dark
#' @inheritDotParams hc_theme_ids_dark
#'
#' @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 = textColor ,
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.
#'
#' @inheritParams hc_theme_ids_dark
#' @inheritDotParams hc_theme_ids_dark
#'
#' @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 = idsPaletteGreyscale,
backgroundColor = "white",
textColor = "black",
highContrastColor = "black",
lowContrastColor = "#A0A0A3",
tooltipBackgroundColor = "white",
boxplotFillColor = "#505053",
candlestickColor = "grey",
errorbarColor = "grey",
...
)
}