-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Issue
Currently, the colors used in the print methods of STATcubeR only really work with dark editor themes. This is why there are setup-scripts like these to make the pkgdown-docs look nice despite having a light theme.
Lines 15 to 17 in 4537d3e
| options(cli.theme = list( | |
| ".field" = list("color" = "#0d0d73"), | |
| ".code" = list("color" = "blue"), |
Lines 5 to 7 in 99659dc
| STATcubeR.schema_colors = list( | |
| "FOLDER" = "#4400cc", "DATABASE" = "#186868", "TABLE" = "#624918", | |
| "GROUP" = "#4400cc", "FIELD" = "cyan", "VALUESET" = "cadetblue", |
Challenge
Since there is a substantial amount of R users using light editor themes, make sure that a freshly installed version of STATcubeR works with both light and dark editors. Additionaly, keep the current color palletes as a "dark-theme" and add some way to switch between the default theme and the dark theme. Simplify the pkgdown setup by just using the new default-theme.
Implementation
In order to make the theming system powerful engough to include all current "theme-adaptations" for pkgdown, it is necessary to provide
- color palettes for schema types
- color palettes for annotations (re-implement annotatons #39)
- override some
{cli}options. (possibly a bad idea, TBD)
There is already some prototyping which uses theme-definitions in inst/themes/{theme}.json with the following structure.
{
"description": "default theme for STATcubeR",
"schema": {"FOLDER": "#4400cc", "DATABASE": "#186868", "TABLE": "#624918", "...": "..."},
"annotations": ["#4400cc", "#186868", "#624918", "..."],
"cli": {".field": {"color": "#0d0d73"}, "...": "..."}
}Defaults
It would be possible to autodetect wether a light or dark mode is approprite via rstudioapi::getThemeInfo(). But this would be only applicable for rstudio users. It is probably better to provide a neutral theme, which works in dark and light editors as a default and make optimized themes for dark and light mode opt-in.