From 355d134ca077363befcb87463c8d038a23b83a4f Mon Sep 17 00:00:00 2001 From: LitoMore Date: Tue, 4 Oct 2022 20:23:01 +0800 Subject: [PATCH] Add example code --- readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.md b/readme.md index a9a3f56..320f036 100644 --- a/readme.md +++ b/readme.md @@ -205,6 +205,15 @@ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color= All supported style strings are exposed for convenience. `colors` is the combination of `foregroundColors` and `backgroundColors`. +This is useful when checking if a style string is supported: + +```js +import {foregroundColors} from 'chalk'; + +console.log(foregroundColors.includes('pink')); +//=> false +``` + ## Styles ### Modifiers