RStudio Theme Keyboard Shortcut

Hi RStudio,

Thank you for a great product!

Have you considered adding a keyboard shortcut for changing between (perhaps two preferred) themes? During the day I like to work with a white theme, but in the evenings it would be nice if there was a shortcut, to change to my preferred dark theme.

/Kenneth

Very interesting thought! I'm not sure if this is currently a feature or not. Might be worth a mention for a feature request at https://github.com/rstudio/rstudio/issues

It is more likely that we'd expose a way to change the theme using the rstudioapi package; we already have theme functions in there such as getThemeInfo().

You could then build yourself an addin or snippet that you could bind to a key. A little more effort required, but then you could make it work however you want -- for instance, automatically adjusting the theme based on the time of day!

3 Likes

That is a much cooler solution :slight_smile:

1 Like

If you use AutoHotKey then you can bind a shortcut key to the following code to toggle between a day and a night theme.

Path = C:\Users\%A_UserName%\AppData\Local\RStudio-Desktop\monitored\user-settings
FileRead, NewSettings, %Path%\user-settings
If (InStr(NewSettings, "TextMate") == 0) {
NewSettings := StrReplace(NewSettings, "Tomorrow Night Bright", "TextMate")
} Else {
NewSettings := StrReplace(NewSettings, "TextMate", "Tomorrow Night Bright")
}
FileAppend, %NewSettings%, %Path%\NewSettings
FileMove, %Path%\NewSettings, %Path%\user-settings, 1
Return

1 Like

That would be a cool solution. I guess you’ve already thought about this, so no need for a feature request, right?