Skip to contents

Returns a dark theme. All parameters have sensible defaults; most users only need base_font_size. Title font size defaults to 1.2x the base; all other text defaults to 1x. Data-zoom sliders use neutral gray controls adapted to dark backgrounds.

Usage

theme_dark(
  base_font_size = 12,
  title_font_size = NULL,
  subtitle_font_size = NULL,
  axis_label_font_size = NULL,
  legend_font_size = NULL,
  tooltip_font_size = NULL,
  font_family = getOption("rtemis.font_family"),
  color = palette_colors(rtemis_colors),
  bg_color = "#181818",
  fg_color = "rgba(255, 255, 255, 0.7)",
  title_color = "rgba(255, 255, 255, 0.9)",
  subtitle_color = "rgba(255, 255, 255, 0.5)",
  legend_color = NULL,
  axis_color = "rgba(255, 255, 255, 0.3)",
  grid_color = "rgba(255, 255, 255, 0.1)",
  tooltip_bg = "rgba(20, 20, 20, 0.9)",
  tooltip_border_color = "rgba(255, 255, 255, 0.1)",
  tooltip_color = NULL,
  negative_color = SIGN_COLORS[["negative"]],
  neutral_color = SIGN_COLORS[["neutral"]],
  positive_color = SIGN_COLORS[["positive"]]
)

Arguments

base_font_size

Numeric [0, Inf): Base font size in pixels for all text.

title_font_size

Optional Numeric [0, Inf): Title font size.

subtitle_font_size

Optional Numeric [0, Inf): Subtitle font size.

axis_label_font_size

Optional Numeric [0, Inf): Axis-label font size.

legend_font_size

Optional Numeric [0, Inf): Legend font size.

tooltip_font_size

Optional Numeric [0, Inf): Tooltip font size.

font_family

Optional Character scalar: Font family name or CSS font stack, e.g. "Geist" or "Geist, Helvetica, sans-serif". Unless the stack ends in a generic family such as sans-serif, the system UI font stack follows it as the fallback. A family name that is not a sequence of CSS identifiers, e.g. Source Sans 3, is quoted. NULL uses the system UI font stack. The default is the rtemis.font_family option, which sets the font of every rtemis plot, e.g. options(rtemis.font_family = "Geist"). A widget uses the font when the viewer's system has it installed or the page loads it.

color

Character: Color palette.

bg_color

Optional Character: Chart background color.

fg_color

Optional Character: Global text color.

title_color

Optional Character: Title text color.

subtitle_color

Optional Character: Subtitle text color.

legend_color

Optional Character: Legend text color.

axis_color

Optional Character: Axis line color.

grid_color

Optional Character: Grid or split-line color.

tooltip_bg

Optional Character: Tooltip background color.

tooltip_border_color

Optional Character: Tooltip border color.

tooltip_color

Optional Character: Tooltip text color.

negative_color, neutral_color, positive_color

Character: Colors for negative values, values of neither sign, and positive values, in every chart that colors by sign. The defaults, blue, gray and orange, have equal perceived lightness, keep at least 3.9:1 contrast on light and dark backgrounds, and stay distinguishable under deuteranopia and protanopia.

Value

Theme: Theme object.

Examples

theme_dark(base_font_size = 14)
#> <Theme>
#> 
#>              color: <chr> #6CA3A0, #F08904, #BE2E5F, #B3CFE8, ...
#>   background_color: <chr> #181818
#>     negative_color: <chr> #2D83D3
#>      neutral_color: <chr> #808080
#>     positive_color: <chr> #C55E28
#>         text_style:
#> <TextStyle>
#> 
#>                                       color: <chr> rgba(255, 255, 255, 0.7)
#>                                  font_style: <NUL> NULL
#>                                 font_weight: <NUL> NULL
#>                                 font_family: <chr> system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif
#>                                   font_size: <nmr> 14.00
#>                                       align: <NUL> NULL
#>                              vertical_align: <NUL> NULL
#>                                     opacity: <NUL> NULL
#>                                 line_height: <NUL> NULL
#>                            background_color: <NUL> NULL
#>                                border_color: <NUL> NULL
#>                                border_width: <NUL> NULL
#>                                 border_type: <NUL> NULL
#>                          border_dash_offset: <NUL> NULL
#>                               border_radius: <NUL> NULL
#>                                     padding: <NUL> NULL
#>                                       width: <NUL> NULL
#>                                      height: <NUL> NULL
#>                           text_border_color: <NUL> NULL
#>                           text_border_width: <NUL> NULL
#>                            text_border_type: <NUL> NULL
#>                     text_border_dash_offset: <NUL> NULL
#>                            text_shadow_blur: <NUL> NULL
#>                           text_shadow_color: <NUL> NULL
#>                        text_shadow_offset_x: <NUL> NULL
#>                        text_shadow_offset_y: <NUL> NULL
#>                                    overflow: <NUL> NULL
#>                                    ellipsis: <NUL> NULL
#>                                        rich: <NUL> NULL
#>                                 shadow_blur: <NUL> NULL
#>                                shadow_color: <NUL> NULL
#>                             shadow_offset_x: <NUL> NULL
#>                             shadow_offset_y: <NUL> NULL
#>              title: 
#>                        textStyle: 
#>                                      color: <chr> rgba(255, 255, 255, 0.9)
#>                                   fontSize: <nmr> 17.00
#>                     subtextStyle: 
#>                                      color: <chr> rgba(255, 255, 255, 0.5)
#>                                   fontSize: <nmr> 14.00
#>             legend: 
#>                     textStyle: 
#>                                   color: <chr> rgba(255, 255, 255, 0.7)
#>                                fontSize: <nmr> 14.00
#>            tooltip: 
#>                     backgroundColor: <chr> rgba(20, 20, 20, 0.9)
#>                         borderColor: <chr> rgba(255, 255, 255, 0.1)
#>                           textStyle: 
#>                                         color: <chr> rgba(255, 255, 255, 0.7)
#>                                      fontSize: <nmr> 14.00
#>          data_zoom: 
#>                            backgroundColor: <chr> rgba(128,128,128,0.06)
#>                                borderColor: <chr> #606060
#>                                fillerColor: <chr> rgba(128,128,128,0.18)
#>                             dataBackground: 
#>                                             lineStyle: 
#>                                                        color: <chr> #808080
#>                                             areaStyle: 
#>                                                          color: <chr> #808080
#>                                                        opacity: <nmr> 0.12
#>                     selectedDataBackground: 
#>                                             lineStyle: 
#>                                                        color: <chr> #b0b0b0
#>                                             areaStyle: 
#>                                                          color: <chr> #808080
#>                                                        opacity: <nmr> 0.25
#>                                handleStyle: 
#>                                                   color: <chr> #303030
#>                                             borderColor: <chr> #909090
#>                            moveHandleStyle: 
#>                                               color: <chr> #909090
#>                                             opacity: <nmr> 0.60
#>                                 brushStyle: 
#>                                               color: <chr> #808080
#>                                             opacity: <nmr> 0.30
#>                                  textStyle: 
#>                                             fontSize: <nmr> 14.00
#>                                                color: <chr> rgba(255, 255, 255, 0.7)
#>                                   emphasis: 
#>                                                 handleStyle: 
#>                                                              borderColor: <chr> #cccccc
#>                                             moveHandleStyle: 
#>                                                              color: <chr> #b0b0b0
#>               line: 
#>                     symbol: <chr> circle
#>                bar: <NUL> NULL
#>                pie: <NUL> NULL
#>            scatter: <NUL> NULL
#>      category_axis: 
#>                     axisLabel: 
#>                                fontSize: <nmr> 14.00
#>                                   color: <chr> rgba(255, 255, 255, 0.7)
#>                      axisLine: 
#>                                lineStyle: 
#>                                           color: <chr> rgba(255, 255, 255, 0.3)
#>                     splitLine: 
#>                                show: <lgc> FALSE
#>         value_axis: 
#>                     axisLabel: 
#>                                fontSize: <nmr> 14.00
#>                                   color: <chr> rgba(255, 255, 255, 0.7)
#>                      axisLine: 
#>                                lineStyle: 
#>                                           color: <chr> rgba(255, 255, 255, 0.3)
#>                     splitLine: 
#>                                lineStyle: 
#>                                           color: <chr> rgba(255, 255, 255, 0.1)
#>           log_axis: <NUL> NULL
#>          time_axis: <NUL> NULL
#>