Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color palettes in print outputs #41

Open
GregorDeCillia opened this issue Mar 6, 2023 · 1 comment
Open

Color palettes in print outputs #41

GregorDeCillia opened this issue Mar 6, 2023 · 1 comment
Assignees
Labels
cli Changes to the Command Line Interface feature New feature or request
Milestone

Comments

@GregorDeCillia
Copy link
Contributor

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.

STATcubeR/R/zzz.R

Lines 15 to 17 in 4537d3e

options(cli.theme = list(
".field" = list("color" = "#0d0d73"),
".code" = list("color" = "blue"),

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.

@GregorDeCillia GregorDeCillia added feature New feature or request cli Changes to the Command Line Interface labels Mar 6, 2023
@GregorDeCillia GregorDeCillia added this to the Version 1.0 milestone Mar 6, 2023
@GregorDeCillia GregorDeCillia self-assigned this Mar 6, 2023
@GregorDeCillia
Copy link
Contributor Author

It should be fairly straightforward to include a theme for terminals without color support. For example

{ "schema": ["bold", "bold", "..."], "annotations": ["underline", "italic", "bold", "..."] }

@GregorDeCillia GregorDeCillia linked a pull request Apr 6, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Changes to the Command Line Interface feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant