Altering RStudio Editor Theme - css

I am trying to alter an RStudio Editor Themes so that I can set my own colors. I'm using RStudio version 0.99.473 on Windows 10.
I've reviewed Any way to change colors in Rstudio to something other than default options? which was extremely helpful as well as Editing R Studio them in cashe.css theme file (ACE editor?)
I am trying to identify what the different .ace_ items in the RStudio Editor Theme CSS files (ACE editor code) correspond to. The CSS files are found in /www/rstudio/ within RStudio's install path. An example of the script is found on GitHub for the Tomorrow theme.
In particular, I'm looking to see how to color variables (that I define) differently from functions. For example in x <- rnorm(10,0,10), I'd like x and rnorm to be colored differently. Not sure if that's possible.

For what it's worth, the newest versions of RStudio come with a preference that allow you to ensure that function calls are colored differently from variables -- from RStudio v1.0.44, we have the option
Highlight R function calls
With this option active, function calls will be highlighted differently (for example, with Tomorrow Night Bright):
Hopefully, user-customizable themes will become part of the next RStudio release.

RStudio has a tutorial. Although not specific to your question about coloring variables, I did edit the highlighting of matched brackets in my theme so that they are more visible. Here's how:
Select a theme from this theme editor and save it to your machine as a .tmTheme file. Add the theme in RStudio. RStudio automatically creates an .rstheme file from that. I found the rstheme file in my Users/Eric/Documents/.R/rstudio/themes folder (Windows machine). Open the file in Notepad++ (or your favorite text editor) and find the .ace entry that matches the one you want to change (for me, specifically, .ace_bracket from the RStudio tutorial I mentioned earlier). This will have an rgba value similar to: background-color: rgba(238, 252, 81, 0.8); Note that the last value is the alpha (transparency) value and should be between 0 and 1. The values I used give me a nice bright yellow that is easily seen.

I think you are looking for customising the RStudio theme and I think in that case
You can check out the following link:
This website gives you several options to customize
https://tmtheme-editor.herokuapp.com/#!/editor/theme/Azure
This is how it works
Once you are done customizing download them.
Later you can add the theme in the "add" options while setting a theme in your RStudio
Hope this was helpful
Happy Coding :)

I found (2022) the theme files in
C:\Users\<my user>\AppData\Roaming\RStudio\themes

Related

How to set color of cell output of jupyter notebook (.ipynb) in VS Code editor?

Sometimes it is convenient to deal with jupyter notebooks from the VS Code editor (faster load, less latency and easier debugging).
Nonetheless, there is a problem that default theme colors are not contrast enough to distinguish between input and output cells.
I'm having a hard time to figure out which setting I should change, to, let us say, make the output cell background just "dark-grey" (I'm using default VS 2019 Dark theme but other options are also not contrast with .ipynb files).
Any help will be welcome.
(I've also come across other similar questions but did not find the turn key solution.)
Example:
In the settings.json -- can be found at File(Windows)/Code(Mac)>Preferences>Settings -- click on any link stated "Edit in settings.json"
Adding this into the json will work -- notebook's setting has to be put under the workbench.colorCustomizations.
"workbench.colorCustomizations": {
"notebook.outputContainerBackgroundColor": "#FFFFFF",
},
I'm not sure if this helps you, but you can try overriding VSCode's theme by adding this to your settings.json file:
{
"jupyter.ignoreVscodeTheme": true
}
If you prefer to use VSCode's gui to edit settings, you can go to your Jupyter extension (assuming you have it installed) => Extension settings => and check "Ignore Vscode Theme".
You need to restart or reload VSCode for this to take effect.

Rstudio theme text dims when clicking inside a chunk

I've customized a dark theme for Rstudio. The color I've used for comments has odd behavior in .Rmd (R Markdown) documents. It displays nice and bright normally, until I click inside a chunk, then the color dims. It's a small issue, but irritating, and makes the text harder to read. As I scroll down the document, previously dim sections will return to being bright, then return to being dim when I click in the chunk. I have also altered the chunk highlighting for better visibility.
In addition, when selecting themes under Global Options, I need to click on the theme twice for it to display in the example box. For some reason, it seems my system isn't handling the themes as expected.
I'm new to styles/themes/CSS, but I thought there might be an issue with the order my edits were written in.
The edits for the chunk highlighting and comment color are on lines:
101
81
Here is the theme file in question
https://github.com/captaincaed/rstudio/blob/main/vibrant_ink_SB_2.rstheme
Here is a Windows error log (seems to open best in Word, may open in a browser as well)
https://github.com/captaincaed/rstudio/blob/main/Recording_20210119_1453.mht
RStudio
Version 1.4.1103
Windows 10
Thanks in advance!

rstudio color appearance, specific color for package names, front ::

I'm working with R, in RStudio, and I use to specify the package of each function in my scripts, even if the package is already loaded in the environment. I want to be sure that the code will use the filter() function from dplyr, and not from another package which has a similar named function.
For instance :
Question/ to make code easier to read, is there a way to play with global appearance colors, and that package names (all names before ::) are in a different color (light grey for instance) ?
Here is a complete answer, I guess will work.
Since a recent version of rstudio, you can add custom themes on rstudio (see this update blog)
From this point you can create custom themes, but it require you to know the "code" for each part of your script. After opening the inspector, I've foudn that the dplyr word before the :: is named as support. See the color used in the theme Cobalt here (custom theme editor).
Finally, once you created your own theme by modification of a previous one (creating from scratch is always a pain), you import it in rstudio (see in the first link) and apply it.
At this point you won't see any change, because you also need to check Global options > Code > Diplay > highlight R function call. This will highlight the word classified as support and as support.function. You can set both colors in the theme editor (Cobalt theme has the first one in light green and the second one in light orange).
I've not done the full process myself but I think it could work.
You can modify themes at this website: https://tmtheme-editor.herokuapp.com/#!/editor/local/Monokai
If you go to Customize Preview Code at the bottom right, you can test out the code in your image above.
If you change the color for variable, it seems like this makes the change you're looking for.
When you've customized everything to your liking, you can download your custom theme. Then you can go back to Rstudio --> Tools --> Global Options --> Appearance, and click 'Add' to add your theme.

How do I apply RStudio themes only to the source and console backgrounds and not to the whole GUI?

I'm using RStudio 1.1.383 and R 3.4.3 and I'm trying to apply a theme under Options > Appearance only to the background text area of the source pane and the console pane. This is exactly what happens when I apply a theme on my desktop computer (Win10), but when I apply a theme on my laptop (also Win10), it applies the theme to the entire GUI except for the top menu bar (i.e. File, Edit, Code, etc). The result looks jarring. Why might themes be behaving differently between my two computers which use identical setups? Is there an option that I might have selected somewhere on one and not the other that would cause the theme to apply to just the text area of a couple panes in one case and the entire GUI in the other?
This is a change in RStudio v1.1 -- now, when a 'dark' editor theme is selected, the entire IDE will be themed to match that.
If you'd prefer to have a dark editor theme with a light IDE theme, that's unfortunately not possible in v1.1. You might want to file a feature request at https://github.com/rstudio/rstudio/issues.

Change background color of selected code in IPython Notebook

I'm using the Base16 Ocean dark theme on IPython Notebook.
The background color of selected text doesn't contrast very well, making it difficult to tell if it's selected:
On the default settings, this does not occur:
Please let me know how to change the background color of selected code on IPython Notebook to a more clear one.
Run the following code in a notebook to find out the jupyter config folder on your system, if you don't know it yet:
from jupyter_core.paths import jupyter_config_dir
jupyter_dir = jupyter_config_dir()
print(jupyter_dir)
In the jupyter config folder, find /custom/custom.css, modify the following line:
.cm-s-ipython div.CodeMirror-selected {background: #384151 !important;}
I use '#3366ff' here, you may use whatever background color that suits your need.
All is well with jimmyazrael answer, but if you're using Jupyter 5.0 from within Anaconda3 you will find your css file at:
C:\Users\YourUsername\Anaconda3\Lib\site-packages\notebook\static\cutom\custom.css
Hope that helped
Mine was I bit more complicated. Couldn't find it in any mentioned folder, thus after searching my system for "custom.css", I have found many of this! It is likely because I had upgraded/downgraded my environment multiple times.
So, in the end, I open the file in:
C:\Users\username\AppData\Local\Continuum\anaconda3\pkgs\notebook-6.1.5-py37haa95532_0\Lib\site-packages\notebook\static\custom\custom.css
Pasted the line:
.cm-s-ipython div.CodeMirror-selected {background: #384151 !important;}
Saved and restarted Jupyter. It worked!

Resources