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

Support rstudioapi::getThemeInfo() #2986

Open
gadenbuie opened this issue May 2, 2024 · 1 comment
Open

Support rstudioapi::getThemeInfo() #2986

gadenbuie opened this issue May 2, 2024 · 1 comment
Labels
area: core Issues related to Core category. enhancement New feature or request lang: r

Comments

@gadenbuie
Copy link

rstudioapi::getThemeInfo() was not included in the initial list of shimmed rstudioapi functions in #1312.

It'd be nice to support this function, in particular because it's used by thematic and would enable automatic theming of plots to reflect the current Positron theme.

Here's the info currently available in RStudio

rstudioapi::getThemeInfo()
#> $editor
#> [1] "Textmate (default)"
#> 
#> $global
#> [1] "Modern"
#> 
#> $dark
#> [1] FALSE
#> 
#> $foreground
#> [1] "rgb(0, 0, 0)"
#> 
#> $background
#> [1] "rgb(255, 255, 255)"

In particular, the key bits that I'd like to see in Positron:

  1. foreground
  2. background
  3. dark (would be nice)
  4. editor (would be nice)

I don't think we'd need the global item, or that could be "Positron".

@gadenbuie gadenbuie added the enhancement New feature or request label May 2, 2024
@juliasilge juliasilge added the area: core Issues related to Core category. label May 2, 2024
@jennybc jennybc added the lang: r label May 3, 2024
@juliasilge juliasilge added this to the Future milestone May 6, 2024
@jennybc jennybc modified the milestones: Future, Release Candidate Sep 3, 2024
@jennybc
Copy link
Member

jennybc commented Sep 3, 2024

I just moved this into release candidate, because I'm about to make a change in reprex that won't fully take effect in Positron, until we offer rstudioapi::getThemeInfo().

In reprex's case, it's dark (TRUE / FALSE) that is really important, so a bit different from @gadenbuie's priorities.

We discussed this briefly in the R sync today, so I'll leave a few notes for whoever picks this up:

  • We suspect returning "Modern" for the global theme is the right call. It is a concept that doesn't really map over to VS Code / Positron, so this is going to be somewhat artificial.
  • Implementation will probably look a lot like the existing implementation of evaluate_when_clause in the ui comm.

jennybc added a commit to tidyverse/reprex that referenced this issue Sep 10, 2024
Positron doesn't support dark vs. light mode detection from R yet (posit-dev/positron#2986), but reprex will just use light mode unconditionally for now. Which is still better than the current fugliness.
jennybc added a commit to tidyverse/reprex that referenced this issue Sep 10, 2024
* This wasn't doing anything anyway.

The reason we have had syntax highlighting in the html preview is because of some styling added at the end of the github css.

* Add a helper to detect dark mode

Positron doesn't support dark vs. light mode detection from R yet (posit-dev/positron#2986), but reprex will just use light mode unconditionally for now. Which is still better than the current fugliness.

* Grab github CSS: the opening move

* Fixup the github CSS for our application

* Take github css from here, in reprex; stop using a template

* Add a custom syntax highlighting theme

* Vendor the R syntax definition

* Fixup r.xml

* Install pandoc in the test-coverage job

* Go back to `verbose = FALSE`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to Core category. enhancement New feature or request lang: r
Projects
None yet
Development

No branches or pull requests

3 participants