Skip to content

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)

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.

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.

Value

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

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.

Examples

ansi_palettes
#>                   black     red   green  yellow    blue magenta    cyan
#> dichro          #000000 #882255 #117733 #ddcc77 #332288 #aa4499 #88ccee
#> vga             #000000 #aa0000 #00aa00 #aa5500 #0000aa #aa00aa #00aaaa
#> winxp           #000000 #800000 #008000 #808000 #000080 #800080 #008080
#> vscode          #000000 #cd3131 #0dbc79 #e5e510 #2472c8 #bc3fbc #11a8cd
#> win10           #0c0c0c #c50f1f #13a10e #c19c00 #0037da #881798 #3a96dd
#> macos           #000000 #c23621 #25bc24 #adad27 #492ee1 #d338d3 #33bbc8
#> putty           #000000 #bb0000 #00bb00 #bbbb00 #0000bb #bb00bb #00bbbb
#> mirc            #000000 #7f0000 #009300 #fc7f00 #00007f #9c009c #009393
#> xterm           #000000 #cd0000 #00cd00 #cdcd00 #0000ee #cd00cd #00cdcd
#> ubuntu          #010101 #de382b #39b54a #ffc706 #006fb8 #762671 #2cb5e9
#> eclipse         #000000 #cd0000 #00cd00 #cdcd00 #0000ee #cd00cd #00cdcd
#> iterm           #000000 #c91b00 #00c200 #c7c400 #0225c7 #ca30c7 #00c5c7
#> iterm-pastel    #626262 #ff8373 #b4fb73 #fffdc3 #a5d5fe #ff90fe #d1d1fe
#> iterm-smoooooth #14191e #b43c2a #00c200 #c7c400 #2744c7 #c040be #00c5c7
#> iterm-snazzy    #000000 #ff5c57 #5af78e #f3f99d #57c7ff #ff6ac1 #9aedfe
#> iterm-solarized #073642 #dc322f #859900 #b58900 #268bd2 #d33682 #2aa198
#> iterm-tango     #000000 #d81e00 #5ea702 #cfae00 #427ab3 #89658e #00a7aa
#>                   white br_black  br_red br_green br_yellow br_blue
#> dichro          #e5e5e5  #000000 #cc6677  #999933   #ddcc77 #44aa99
#> vga             #aaaaaa  #555555 #ff5555  #55ff55   #ffff55 #5555ff
#> winxp           #c0c0c0  #808080 #ff0000  #00ff00   #ffff00 #0000ff
#> vscode          #e5e5e5  #666666 #f14c4c  #23d18b   #f5f543 #3b8eea
#> win10           #cccccc  #767676 #e74856  #16c60c   #f9f1a5 #3b78ff
#> macos           #cbcccd  #818383 #fc391f  #31e722   #eaec23 #5833ff
#> putty           #bbbbbb  #555555 #ff5555  #55ff55   #ffff55 #5555ff
#> mirc            #d2d2d2  #7f7f7f #ff0000  #00fc00   #ffff00 #0000fc
#> xterm           #e5e5e5  #7f7f7f #ff0000  #00ff00   #ffff00 #5c5cff
#> ubuntu          #cccccc  #808080 #ff0000  #00ff00   #ffff00 #0000ff
#> eclipse         #e5e5e5  #000000 #ff0000  #00ff00   #ffff00 #5c5cff
#> iterm           #c7c7c7  #686868 #ff6e67  #5ffa68   #fffc67 #6871ff
#> iterm-pastel    #f1f1f1  #8f8f8f #ffc4be  #d6fcba   #fffed5 #c2e3ff
#> iterm-smoooooth #c7c7c7  #686868 #dd7975  #58e790   #ece100 #a7abf2
#> iterm-snazzy    #f1f1f0  #686868 #ff5c57  #5af78e   #f3f99d #57c7ff
#> iterm-solarized #eee8d5  #002b36 #cb4b16  #586e75   #657b83 #839496
#> iterm-tango     #dbded8  #686a66 #f54235  #99e343   #fdeb61 #84b0d8
#>                 br_magenta br_cyan br_white
#> dichro             #aa4499 #88ccee  #ffffff
#> vga                #ff55ff #55ffff  #ffffff
#> winxp              #ff00ff #00ffff  #ffffff
#> vscode             #d670d6 #29b8db  #e5e5e5
#> win10              #b4009e #61d6d6  #f2f2f2
#> macos              #f935f8 #14f0f0  #e9ebeb
#> putty              #ff55ff #55ffff  #ffffff
#> mirc               #ff00ff #00ffff  #ffffff
#> xterm              #ff00ff #00ffff  #ffffff
#> ubuntu             #ff00ff #00ffff  #ffffff
#> eclipse            #ff00ff #00ffff  #ffffff
#> iterm              #ff77ff #60fdff  #ffffff
#> iterm-pastel       #ffb2fe #e6e7fe  #ffffff
#> iterm-smoooooth    #e17ee1 #60fdff  #ffffff
#> iterm-snazzy       #ff6ac1 #9aedfe  #f1f1f0
#> iterm-solarized    #6c71c4 #93a1a1  #fdf6e3
#> iterm-tango        #bc94b7 #37e6e8  #f1f1f0
ansi_palette_show("dichro", colors = truecolor)
#>                                                      bright variants
#> blck red  grn  yllw blue mgnt cyan whte  blck red  grn  yllw blue mgnt cyan whte
#> 
#> ████ ████ ████ ████ ████ ████ ████ ████  ████ ████ ████ ████ ████ ████ ████ ████
#> ████ ████ ████ ████ ████ ████ ████ ████  ████ ████ ████ ████ ████ ████ ████ ████
#> ████ ████ ████ ████ ████ ████ ████ ████  ████ ████ ████ ████ ████ ████ ████ ████
#> ████ ████ ████ ████ ████ ████ ████ ████  ████ ████ ████ ████ ████ ████ ████ ████