Color code font to 1) function arguments and 2) iterators in loops

I would like function arguments and iterators in loops to have a different color than the rest of the code. I am currently using the ‘Merbivore Soft’ theme, and in the code below…

fn <- function(x) {
  print(x)
}

a <- c("Hello", "Gutentag", "Bonjour")

for (g in a) {
  fn(g)
}

…’function’, ‘for’, and ‘in’ are orange, ‘”Hello”‘ and other greetings are green, while the rest of the text is white. I would like ‘x’ and ‘g’ to have a different color than white.

Setup details:

R version 4.2.2 (2022-10-31 ucrt)
RStudio/2023.03.1+446
Windows 11.

Leave a Comment