class ChalkBox::Supports
- ChalkBox::Supports
- Reference
- Object
Overview
Detect whether a terminal supports color
This module is based in chalk/supports-color
API
The returned object specifies a level of support for color through a
.level
property and a corresponding flag:
.level = 1 and .hasBasic = true: Basic color support (16 colors)
.level = 2 and .has256 = true: 256 color support
.level = 3 and .has16m = true: 16 million (truecolor) support
Info
It obeys the --color
and --no-color
CLI flags.
For situations where using --color
is not possible,
add an environment variable FORCE_COLOR
with any value to force color.
Trumps --no-color
.
Explicit 256/truecolor mode can be enabled using the
--color=256
and --color=16m
flags, respectively.
Defined in:
chalk_box/supports.crConstructors
Instance Method Summary
-
#has16m
Checks (if not already) and returns if have supports for 16m colors
-
#has256
Checks (if not already) and returns if have supports for 256 colors
-
#hasBasic
Checks (if not already) and returns if have supports for basic ANSI colors
-
#level
Checks (if not already) and returns colors support level
Constructor Detail
Instance Method Detail
Checks (if not already) and returns colors support level
Code levels:
1 - for basic supports
2 - for 256 colors supports
3 - for 16m colors supports