crayon (version 1.1.0)

num_colors: Number of colors the terminal supports

Description

Number of colors the terminal supports

Usage

num_colors(forget = FALSE)

Arguments

forget
Whether to forget the cached result of the color check.

Value

  • Numeric scalar, the number of colors the terminal supports.

Details

We use the tput shell command to detect the number of colors. If tput is not available, but we think that the terminal supports colors, then eigth colors are assumed.

For efficiency, num_colors caches its result. To re-check the number of colors, set the forget argument to TRUE.

Examples

Run this code
num_colors()

Run the code above in your browser using DataLab