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

Selecting a dark editor theme does not switch GUI elements to dark mode and displays some illegible text #11176

Closed
3 of 4 tasks
ptschanz opened this issue May 11, 2022 · 23 comments
Assignees

Comments

@ptschanz
Copy link

@ptschanz ptschanz commented May 11, 2022

System details

RStudio Edition : Desktop
RStudio Version :  2022.02.2 Build 485
OS Version      :  Windows 11
R Version       :  4.2.0

Steps to reproduce the problem

  1. Fresh installation of Windows 11
  2. Applying all Windows updates
  3. Installation of R 4.2.0
  4. Installation of R Studio 2022.02.2 Build 485
  5. Selecting a dark editor theme, such as "Idle Fingers"

Describe the problem in detail

After a fresh installation of Windows 11 and the newest R Studio version, I can only switch to a dark editor theme, but the GUI elements stay in the light theme. Also, the text in the "Files" pane can hardly be read.

image

I tried reinstalling several times, but it didn't help.

Describe the behavior you expected

The GUI elements should also switch to dark mode, like this:
image

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@ptschanz ptschanz changed the title Selecting a dark editor theme does not switch GUI elements to dark mode and displays some text illegible Selecting a dark editor theme does not switch GUI elements to dark mode and displays some illegible text May 11, 2022
@werkstattcodes
Copy link

@werkstattcodes werkstattcodes commented May 11, 2022

Just to add that I am experience the same issue on windows 10. I had filed a post on rstudio's community page here.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 11, 2022

Does changing the RStudio theme: in Tools -> Global Options... -> Appearance make a difference? (E.g. try changing it to "Sky" and back to "Modern")

Screen Shot 2022-05-11 at 11 04 29 AM

Or, does switching to a light theme and then later back to a dark theme make a difference? (Or, do you see some "dark" themes work as expected, while others do not?)

@ptschanz
Copy link
Author

@ptschanz ptschanz commented May 11, 2022

Changing between "Modern" and "Sky" or between light and dark themes does not solve the problem. It seems that all the light themes are displayed correctly, but all the dark themes not. It's not just that the GUI does not switch to dark mode, but also the pane that displays "Files", "Help", etc shows text really strange. For example the blue hyperlinks (see picture above), but also in the help function (see below). No problem with the light themes.

image

@heteyszabolcs
Copy link

@heteyszabolcs heteyszabolcs commented May 13, 2022

I experience exactly the same. Temporary solution is that you right click on file names, select Inspect element, and then you set a different color for the filenames. Although, if you re-enter RStudio the issue is still not solved.

1 similar comment
@heteyszabolcs
Copy link

@heteyszabolcs heteyszabolcs commented May 13, 2022

I experience exactly the same. Temporary solution is that you right click on file names, select Inspect element, and then you set a different color for the filenames. Although, if you re-enter RStudio the issue is still not solved.

@ptschanz
Copy link
Author

@ptschanz ptschanz commented May 13, 2022

I just found out a "hack" that solves the problem, and which might help developers to understand the bug. It seems that what you do in a previous installation of R Studio (even after uninstalling) affects what happens in a new installation of R Studio.

Here are the steps that I can reproduce to fix the problem:

  1. Uninstall R Studio 2022.02.2 Build 485
  2. Install R Studio 2021.09.0 Build 351
  3. Switch between themes and then select a dark theme (I used "Idle Finger") -> now the GUI elements are displayed correctly, but still some problems in the pane ("Files" ok, not with illegible hyperlinks, but the "Help" pane shows blurry text in the function description)
  4. Uninstall R Studio 2021.09.0 Build 351
  5. Install R Studio 2022.02.2 Build 485
  6. Don't change themes anymore!

Now everything looks the way it should. I can also uninstall and install R Studio 2022.02.2 Build 485 again and it remains intact. But as soon as you try to switch back and forth between themes, the dark theme is corrupted again and it remains corrupted even after uninstalling and reinstalling. However, when carrying out above steps, it is fixed again.

I hope this helps developers to understand the cause of the problem and others to temporarily fix the issue.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 13, 2022

Marking for triage since it looks like this is a bug that could affect anyone updating from PT to SW after release.

@mluerig
Copy link

@mluerig mluerig commented May 16, 2022

I have the same issue on a freshly installed windows 10, no previous installations of Rstudio on the machine: https://community.rstudio.com/t/dark-themes-are-not-being-fully-applied-in-rstudio/136977/2

@mluerig
Copy link

@mluerig mluerig commented May 16, 2022

as suggested above, I tried to install older versions (after removing the user data folders for Rstudio), but I keep getthing this:
image

@ptschanz
Copy link
Author

@ptschanz ptschanz commented May 16, 2022

I had this too when trying with a version older than 2021.09.0 Build 351 but it worked with 2021.09.0 Build 351 in my case.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 16, 2022

I still haven't been able to reproduce this locally.

If you're still having trouble, can you please share the output of:

.rs.api.getThemeInfo()

while you have a dark theme active? It's possible that RStudio is incorrectly inferring that a "dark" theme is actually a "light" theme.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 16, 2022

I'd also be curious to know whether usage of rsthemes is a common ground -- e.g. has everyone experiencing this issue used rsthemes in the past? (from https://github.com/gadenbuie/rsthemes)

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 16, 2022

Finally, if you right click somewhere in the IDE surface and click Inspect Element in the context menu, you should be able to view the DOM used by RStudio.

image

Do you see the "rstudio-themes-dark-menus" class applied on the body element? Or, the "rstudio-themes-dark" class applied to the associated div (see highlight in picture)?

@werkstattcodes
Copy link

@werkstattcodes werkstattcodes commented May 17, 2022

Can't answer for the OP, but in my case, when using the "Express" theme (a dark theme which comes with RStudio), I have the following DOM:
image

See also here

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 17, 2022

@werkstattcodes, thank you! Your output in gadenbuie/rsthemes#86 (comment) also confirms that RStudio is incorrectly concluding the theme is a light theme (ie: not dark).

Do you see the same behavior for RStudio's built-in dark themes?

Could you also share a diagnostics report?

Do you know if the installed theme file has a comment header with the contents:

/* rs-theme-is-dark: TRUE */

(this is what RStudio reads to infer if a theme is dark)

Finally, does resetting RStudio's state make a difference? See https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State for more details. In particular, you need to rename (or remove) the folder located at:

C:\Users\<username>\AppData\Local\RStudio

@ptschanz
Copy link
Author

@ptschanz ptschanz commented May 18, 2022

Below the requested output before and after working correctly and the diagnostic report. I have never used rsthemes

Output before it "breaks"

This is the output when R Studio is correctly displaying a built-in dark theme (using the above hack).

.rs.api.getThemeInfo()

$editor
[1] "Idle Fingers"

$global
[1] "Modern"

$dark
[1] TRUE

$foreground
[1] "rgb(255, 255, 255)"

$background
[1] "rgb(50, 50, 50)"

image

Output after it "breaks"

This is the output after I switch to another theme and than back to the same theme as above:

.rs.api.getThemeInfo()

$editor
[1] "Idle Fingers"

$global
[1] "Modern"

$dark
[1] FALSE

$foreground
[1] "rgb(255, 255, 255)"

$background
[1] "rgb(50, 50, 50)"

image

diagnostics-report.txt

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 18, 2022

Thanks! There are a lot of errors in the logs of the form:

WARNING rs-theme-is-dark value is not a valid boolean string for theme "Monokai" (C:/Program Files/RStudio/resources/themes/monokai.rstheme);

Can you please share the contents of that file? Also, do you recall ever intentionally modifying the installed theme files, or anything like that?

@ptschanz
Copy link
Author

@ptschanz ptschanz commented May 18, 2022

I did a fresh installation of Windows 11 (formating all drives) and then installed R Studio. The first thing I did was to change the theme and then the problem already happened, so without any other modifications in R Studio. I am also dual booting with Linux Mint where it works fine.

Here the file:

monokai.zip

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 18, 2022

Thanks. I have some idea as to what the problem could be and will take a look tomorrow.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 24, 2022

@ptschanz, we have a candidate fix for this coming in the next daily builds. If you have time, would you be able to test the next builds available at https://dailies.rstudio.com/? (Please wait until build 442 is available.)

Thanks!

@ptschanz
Copy link
Author

@ptschanz ptschanz commented May 25, 2022

@kevinushey thanks for your quick reponse and fix to the raised issue!

After installation of build 442, the theme is first display incorrectly (the same as before), but after switching themes at least once, everything is displayed correctly (GUI panels dark, no dark blue hyperlinks anymore, no blurry text in help pane). I can now switch back and forth between themes and all is perfect!

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented May 25, 2022

@ptschanz That's great news; thank you for taking the time to test and report back!

@sternenklar
Copy link

@sternenklar sternenklar commented Jul 14, 2022

I have the same issue on a newly installed Windows 10 system. Changing between themes doesn't solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants