method WriteStream.prototype.getColorDepth
Usage in Deno
import { WriteStream } from "node:tty";
WriteStream.prototype.getColorDepth(env?: object): number
Returns:
1for 2,4for 16,8for 256,24for 16,777,216 colors supported.
Use this to determine what colors the terminal supports. Due to the nature of
colors in terminals it is possible to either have false positives or false
negatives. It depends on process information and the environment variables that
may lie about what terminal is used.
It is possible to pass in an env object to simulate the usage of a specific
terminal. This can be useful to check how specific environment settings behave.
To enforce a specific color support, use one of the below environment settings.
- 2 colors:
FORCE_COLOR = 0(Disables colors) - 16 colors:
FORCE_COLOR = 1 - 256 colors:
FORCE_COLOR = 2 - 16,777,216 colors:
FORCE_COLOR = 3
Disabling color support is also possible by using the NO_COLOR andNODE_DISABLE_COLORS environment variables.
number