code_theme_list: Syntax highlighting themes

View source: R/prettycode.R

code_theme_listR Documentation

Syntax highlighting themes

Description

code_theme_list() lists the built-in code themes.

Usage

code_theme_list()

Value

Character vector of the built-in code theme names.

Code themes

A theme is a list of character vectors, except for bracket, see below. Each character vector must contain RGB colors (e.g. "#a9a9a9"), and cli styles, e.g. "bold". Entries in the list:

  • reserved: reserved words

  • number: numeric literals

  • null: the NULL constant

  • operator: operators, including assignment

  • call: function calls

  • string: character literals

  • comment: comments

  • bracket: brackets: (){}[] This is a list of character vectors, to create "rainbow" brackets. It is recycled for deeply nested lists.

The default code theme

In RStudio, it matches the current theme of the IDE.

You can use three options to customize the code theme:

  • If cli.code_theme is set, it is used.

  • Otherwise if R is running in RStudio and cli.code_theme_rstudio is set, then it is used.

  • Otherwise if T is not running in RStudio and cli.code_theme_terminal is set, then it is used.

You can set these options to the name of a built-in theme, or to list that specifies a custom theme. See code_theme_list() for the list of the built-in themes.

See Also

Other syntax highlighting: code_highlight()

Examples

code_theme_list()
code_highlight(deparse(get), code_theme = "Solarized Dark")

r-pkgs/boxes documentation built on April 27, 2024, 11:08 a.m.