ansi_palettes: ANSI colors palettes

truecolorR Documentation

ANSI colors palettes

Description

If your platform supports at least 256 colors, then you can configure the colors that cli uses for the eight base and the eight bright colors. (I.e. the colors of col_black(), col_red(), and col_br_black(), col_br_red(), etc.

Usage

truecolor

ansi_palettes

ansi_palette_show(palette = NULL, colors = num_ansi_colors(), rows = 4)

Arguments

palette

The palette to show, in the same format as for the cli.palette option, so it can be the name of a built-in palette, of a list of 16 colors.

colors

Number of ANSI colors to use the show the palette. If the platform does not have sufficient support, the output might have a lower color resolution. Without color support it will have no color at all.

rows

The number of colored rows to print.

Format

truecolor is an integer scalar.

ansi_palettes is a data frame with one row for each palette, and one column for each base ANSI color. attr(ansi_palettes, "info") contains a list with information about each palette.

Details

truecolor is an integer constant for the number of 24 bit ANSI colors.

To customize the default palette, set the cli.palette option to the name of a built-in palette (see ansi_palettes()), or the list of 16 colors. Colors can be specified with RGB colors strings: ⁠#rrggbb⁠ or R color names (see the output of grDevices::colors()).

For example, you can put this in your R profile:

options(cli.palette = "vscode")

It is currently not possible to configure the background colors separately, these will be always the same as the foreground colors.

If your platform only has 256 colors, then the colors specified in the palette have to be interpolated. On true color platforms they RGB values are used as-is.

ansi_palettes is a data frame of the built-in palettes, each row is one palette.

ansi_palette_show() shows the colors of an ANSI palette on the screen.

Value

ansi_palette_show returns a character vector, the rows that are printed to the screen, invisibly.

Examples

ansi_palettes
ansi_palette_show("dichro", colors = truecolor)

cli documentation built on June 22, 2024, 10:57 a.m.