STATcubeR
STATcubeR copied to clipboard
Color palettes in print outputs
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.
https://github.com/statistikat/STATcubeR/blob/4537d3ebac11624e1429de218963c96907d1b607/R/zzz.R#L15-L17
https://github.com/statistikat/STATcubeR/blob/99659dc1d7da6281d3a797c311c660b7294958a8/vignettes/R/setup.R#L5-L7
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 (#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.