writeStream.getColorDepth([env])
返回:
【Returns:】
1换2,4对应 16,8表示256,24支持 16,777,216 种颜色。
使用这个来确定终端支持哪些颜色。由于终端中色彩的特性,可能会出现假阳性或假阴性。这取决于进程信息和可能对所使用终端有所掩饰的环境变量。可以传入一个 env 对象来模拟特定终端的使用。这对于检查特定环境设置的行为非常有用。
【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 种颜色:
FORCE_COLOR = 0(禁用颜色) - 16 色:
FORCE_COLOR = 1 - 256 色:
FORCE_COLOR = 2 - 16,777,216 色:
FORCE_COLOR = 3
也可以通过使用 NO_COLOR 和 NODE_DISABLE_COLORS 环境变量来禁用颜色支持。
【Disabling color support is also possible by using the NO_COLOR and
NODE_DISABLE_COLORS environment variables.】