\doxysection*{~\newline
 ~\newline
  ~\newline
 ~\newline
 ~\newline
 }

\begin{quote}
Terminal string styling done right \end{quote}
\href{https://travis-ci.org/chalk/chalk}{\texttt{ }} \href{https://coveralls.io/github/chalk/chalk?branch=master}{\texttt{ }} \href{https://www.youtube.com/watch?v=9auOCbH5Ns4}{\texttt{ }} \href{https://github.com/xojs/xo}{\texttt{ }} \href{https://github.com/sindresorhus/awesome-nodejs}{\texttt{ }}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5041}{}\doxysubsubsection{$<$a href=\char`\"{}https\+://github.\+com/chalk/chalk/releases/tag/v2.\+0.\+0\char`\"{}$>$\+See what\textquotesingle{}s new in Chalk 2$<$/a$>$}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5041}
\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5042}{}\doxysubsection{Highlights}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5042}

\begin{DoxyItemize}
\item Expressive API
\item Highly performant
\item Ability to nest styles
\item \href{\#256-and-truecolor-color-support}{\texttt{ 256/\+Truecolor color support}}
\item Auto-\/detects color support
\item Doesn\textquotesingle{}t extend {\ttfamily String.\+prototype}
\item Clean and focused
\item Actively maintained
\item \href{https://www.npmjs.com/browse/depended/chalk}{\texttt{ Used by $\sim$23,000 packages}} as of December 31, 2017
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5043}{}\doxysubsection{Install}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5043}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install chalk }

\end{DoxyCode}


\href{https://www.patreon.com/sindresorhus}{\texttt{  }}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5044}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5044}

\begin{DoxyCode}{0}
\DoxyCodeLine{const chalk = require('chalk');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(chalk.blue('Hello world!')); }

\end{DoxyCode}


Chalk comes with an easy to use composable API where you just chain and nest the styles you want.


\begin{DoxyCode}{0}
\DoxyCodeLine{const chalk = require('chalk');}
\DoxyCodeLine{const log = console.log;}
\DoxyCodeLine{}
\DoxyCodeLine{// Combine styled and normal strings}
\DoxyCodeLine{log(chalk.blue('Hello') + ' World' + chalk.red('!'));}
\DoxyCodeLine{}
\DoxyCodeLine{// Compose multiple styles using the chainable API}
\DoxyCodeLine{log(chalk.blue.bgRed.bold('Hello world!'));}
\DoxyCodeLine{}
\DoxyCodeLine{// Pass in multiple arguments}
\DoxyCodeLine{log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));}
\DoxyCodeLine{}
\DoxyCodeLine{// Nest styles}
\DoxyCodeLine{log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));}
\DoxyCodeLine{}
\DoxyCodeLine{// Nest styles of the same type even (color, underline, background)}
\DoxyCodeLine{log(chalk.green(}
\DoxyCodeLine{    'I am a green line ' +}
\DoxyCodeLine{    chalk.blue.underline.bold('with a blue substring') +}
\DoxyCodeLine{    ' that becomes green again!'}
\DoxyCodeLine{));}
\DoxyCodeLine{}
\DoxyCodeLine{// ES2015 template literal}
\DoxyCodeLine{log(`}
\DoxyCodeLine{CPU: \$\{chalk.red('90\%')\}}
\DoxyCodeLine{RAM: \$\{chalk.green('40\%')\}}
\DoxyCodeLine{DISK: \$\{chalk.yellow('70\%')\}}
\DoxyCodeLine{`);}
\DoxyCodeLine{}
\DoxyCodeLine{// ES2015 tagged template literal}
\DoxyCodeLine{log(chalk`}
\DoxyCodeLine{CPU: \{red \$\{cpu.totalPercent\}\%\}}
\DoxyCodeLine{RAM: \{green \$\{ram.used / ram.total * 100\}\%\}}
\DoxyCodeLine{DISK: \{rgb(255,131,0) \$\{disk.used / disk.total * 100\}\%\}}
\DoxyCodeLine{`);}
\DoxyCodeLine{}
\DoxyCodeLine{// Use RGB colors in terminal emulators that support it.}
\DoxyCodeLine{log(chalk.keyword('orange')('Yay for orange colored text!'));}
\DoxyCodeLine{log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));}
\DoxyCodeLine{log(chalk.hex('\#DEADED').bold('Bold gray!')); }

\end{DoxyCode}


Easily define your own themes\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const chalk = require('chalk');}
\DoxyCodeLine{}
\DoxyCodeLine{const error = chalk.bold.red;}
\DoxyCodeLine{const warning = chalk.keyword('orange');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(error('Error!'));}
\DoxyCodeLine{console.log(warning('Warning!')); }

\end{DoxyCode}


Take advantage of console.\+log \href{https://nodejs.org/docs/latest/api/console.html\#console_console_log_data_args}{\texttt{ string substitution}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const name = 'Sindre';}
\DoxyCodeLine{console.log(chalk.green('Hello \%s'), name);}
\DoxyCodeLine{//=> 'Hello Sindre' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5045}{}\doxysubsection{API}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5045}
\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5046}{}\doxysubsubsection{chalk.$<$tt$>$$<$style$>$\mbox{[}.$<$style$>$...\mbox{]}(string, \mbox{[}string...\mbox{]})$<$/tt$>$}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5046}
Example\+: `chalk.\+red.\+bold.\+underline(\textquotesingle{}Hello', \textquotesingle{}world\textquotesingle{});\`{}

Chain \href{\#styles}{\texttt{ styles}} and call the last one as a method with a string argument. Order doesn\textquotesingle{}t matter, and later styles take precedent in case of a conflict. This simply means that {\ttfamily chalk.\+red.\+yellow.\+green} is equivalent to {\ttfamily chalk.\+green}.

Multiple arguments will be separated by space.\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5047}{}\doxysubsubsection{chalk.\+enabled}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5047}
Color support is automatically detected, as is the level (see {\ttfamily chalk.\+level}). However, if you\textquotesingle{}d like to simply enable/disable Chalk, you can do so via the {\ttfamily .enabled} property.

Chalk is enabled by default unless explicitly disabled via the constructor or {\ttfamily chalk.\+level} is {\ttfamily 0}.

If you need to change this in a reusable module, create a new instance\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const ctx = new chalk.constructor(\{enabled: false\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5048}{}\doxysubsubsection{chalk.\+level}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5048}
Color support is automatically detected, but you can override it by setting the {\ttfamily level} property. You should however only do this in your own code as it applies globally to all Chalk consumers.

If you need to change this in a reusable module, create a new instance\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const ctx = new chalk.constructor(\{level: 0\}); }

\end{DoxyCode}


Levels are as follows\+:

0. All colors disabled
\begin{DoxyEnumerate}
\item Basic color support (16 colors)
\item 256 color support
\item Truecolor support (16 million colors)
\end{DoxyEnumerate}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5049}{}\doxysubsubsection{chalk.\+supports\+Color}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5049}
Detect whether the terminal \href{https://github.com/chalk/supports-color}{\texttt{ supports color}}. Used internally and handled for you, but exposed for convenience.

Can be overridden by the user with the flags {\ttfamily -\/-\/color} and {\ttfamily -\/-\/no-\/color}. For situations where using {\ttfamily -\/-\/color} is not possible, add the environment variable {\ttfamily FORCE\+\_\+\+COLOR=1} to forcefully enable color or {\ttfamily FORCE\+\_\+\+COLOR=0} to forcefully disable. The use of {\ttfamily FORCE\+\_\+\+COLOR} overrides all other color support checks.

Explicit 256/\+Truecolor mode can be enabled using the {\ttfamily -\/-\/color=256} and {\ttfamily -\/-\/color=16m} flags, respectively.\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5050}{}\doxysubsection{Styles}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5050}
\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5051}{}\doxysubsubsection{Modifiers}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5051}

\begin{DoxyItemize}
\item {\ttfamily reset}
\item {\ttfamily bold}
\item {\ttfamily dim}
\item {\ttfamily italic} $\ast$(Not widely supported)$\ast$
\item {\ttfamily underline}
\item {\ttfamily inverse}
\item {\ttfamily hidden}
\item {\ttfamily strikethrough} $\ast$(Not widely supported)$\ast$
\item {\ttfamily visible} (Text is emitted only if enabled)
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5052}{}\doxysubsubsection{Colors}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5052}

\begin{DoxyItemize}
\item {\ttfamily black}
\item {\ttfamily red}
\item {\ttfamily green}
\item {\ttfamily yellow}
\item {\ttfamily blue} $\ast$(On Windows the bright version is used since normal blue is illegible)$\ast$
\item {\ttfamily magenta}
\item {\ttfamily cyan}
\item {\ttfamily white}
\item {\ttfamily gray} (\char`\"{}bright black\char`\"{})
\item {\ttfamily red\+Bright}
\item {\ttfamily green\+Bright}
\item {\ttfamily yellow\+Bright}
\item {\ttfamily blue\+Bright}
\item {\ttfamily magenta\+Bright}
\item {\ttfamily cyan\+Bright}
\item {\ttfamily white\+Bright}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5053}{}\doxysubsubsection{Background colors}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5053}

\begin{DoxyItemize}
\item {\ttfamily bg\+Black}
\item {\ttfamily bg\+Red}
\item {\ttfamily bg\+Green}
\item {\ttfamily bg\+Yellow}
\item {\ttfamily bg\+Blue}
\item {\ttfamily bg\+Magenta}
\item {\ttfamily bg\+Cyan}
\item {\ttfamily bg\+White}
\item {\ttfamily bg\+Black\+Bright}
\item {\ttfamily bg\+Red\+Bright}
\item {\ttfamily bg\+Green\+Bright}
\item {\ttfamily bg\+Yellow\+Bright}
\item {\ttfamily bg\+Blue\+Bright}
\item {\ttfamily bg\+Magenta\+Bright}
\item {\ttfamily bg\+Cyan\+Bright}
\item {\ttfamily bg\+White\+Bright}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5054}{}\doxysubsection{Tagged template literal}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5054}
Chalk can be used as a \href{http://exploringjs.com/es6/ch_template-literals.html\#_tagged-template-literals}{\texttt{ tagged template literal}}.


\begin{DoxyCode}{0}
\DoxyCodeLine{const chalk = require('chalk');}
\DoxyCodeLine{}
\DoxyCodeLine{const miles = 18;}
\DoxyCodeLine{const calculateFeet = miles => miles * 5280;}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(chalk`}
\DoxyCodeLine{  There are \{bold 5280 feet\} in a mile.}
\DoxyCodeLine{  In \{bold \$\{miles\} miles\}, there are \{green.bold \$\{calculateFeet(miles)\} feet\}.}
\DoxyCodeLine{`); }

\end{DoxyCode}


Blocks are delimited by an opening curly brace ({\ttfamily \{}), a style, some content, and a closing curly brace ({\ttfamily \}}).

Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));}
\DoxyCodeLine{console.log(chalk`\{bold.rgb(10,100,200) Hello!\}`); }

\end{DoxyCode}


Note that function styles ({\ttfamily rgb()}, {\ttfamily hsl()}, {\ttfamily keyword()}, etc.) may not contain spaces between parameters.

All interpolated values ({\ttfamily chalk\`{}\$\{foo\}\`{}}) are converted to strings via the {\ttfamily .to\+String()} method. All curly braces ({\ttfamily \{} and {\ttfamily \}}) in interpolated value strings are escaped.\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5055}{}\doxysubsection{256 and Truecolor color support}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5055}
Chalk supports 256 colors and \href{https://gist.github.com/XVilka/8346728}{\texttt{ Truecolor}} (16 million colors) on supported terminal apps.

Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying {\ttfamily \{level\+: n\}} as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of \#\+FF0000 (red) to 31 (ANSI escape for red).

Examples\+:


\begin{DoxyItemize}
\item `chalk.\+hex('\#\+DEADED\textquotesingle{}).underline(\textquotesingle{}Hello, world!\textquotesingle{}){\ttfamily  -\/}chalk.\+keyword(\textquotesingle{}orange\textquotesingle{})(\textquotesingle{}Some orange text\textquotesingle{}){\ttfamily  -\/}chalk.\+rgb(15, 100, 204).inverse(\textquotesingle{}Hello!\textquotesingle{})\`{}
\end{DoxyItemize}

Background versions of these models are prefixed with {\ttfamily bg} and the first level of the module capitalized (e.\+g. {\ttfamily keyword} for foreground colors and {\ttfamily bg\+Keyword} for background colors).


\begin{DoxyItemize}
\item `chalk.\+bg\+Hex('\#\+DEADED\textquotesingle{}).underline(\textquotesingle{}Hello, world!\textquotesingle{}){\ttfamily  -\/}chalk.\+bg\+Keyword(\textquotesingle{}orange\textquotesingle{})(\textquotesingle{}Some orange text\textquotesingle{}){\ttfamily  -\/}chalk.\+bg\+Rgb(15, 100, 204).inverse(\textquotesingle{}Hello!\textquotesingle{})\`{}
\end{DoxyItemize}

The following color models can be used\+:


\begin{DoxyItemize}
\item \href{https://en.wikipedia.org/wiki/RGB_color_model}{\texttt{ {\ttfamily rgb}}} -\/ Example\+: `chalk.\+rgb(255, 136, 0).bold(\textquotesingle{}Orange!'){\ttfamily }
\item {\ttfamily \mbox{[}}hex{\ttfamily \mbox{]}(\href{https://en.wikipedia.org/wiki/Web_colors}{\texttt{ https\+://en.\+wikipedia.\+org/wiki/\+Web\+\_\+colors}}\#Hex\+\_\+triplet) -\/ Example\+:}chalk.\+hex(\textquotesingle{}\#\+FF8800\textquotesingle{}).bold(\textquotesingle{}Orange!\textquotesingle{}){\ttfamily }
\item {\ttfamily \mbox{[}}keyword{\ttfamily \mbox{]}(\href{https://www.w3.org/wiki/CSS/Properties/color/keywords}{\texttt{ https\+://www.\+w3.\+org/wiki/\+CSS/\+Properties/color/keywords}}) (CSS keywords) -\/ Example\+:}chalk.\+keyword(\textquotesingle{}orange\textquotesingle{}).bold(\textquotesingle{}Orange!\textquotesingle{}){\ttfamily }
\item {\ttfamily \mbox{[}}hsl{\ttfamily \mbox{]}(\href{https://en.wikipedia.org/wiki/HSL_and_HSV}{\texttt{ https\+://en.\+wikipedia.\+org/wiki/\+HSL\+\_\+and\+\_\+\+HSV}}) -\/ Example\+:}chalk.\+hsl(32, 100, 50).bold(\textquotesingle{}Orange!\textquotesingle{}){\ttfamily }
\item {\ttfamily \mbox{[}}hsv{\ttfamily \mbox{]}(\href{https://en.wikipedia.org/wiki/HSL_and_HSV}{\texttt{ https\+://en.\+wikipedia.\+org/wiki/\+HSL\+\_\+and\+\_\+\+HSV}}) -\/ Example\+:}chalk.\+hsv(32, 100, 100).bold(\textquotesingle{}Orange!\textquotesingle{}){\ttfamily }
\item {\ttfamily \mbox{[}}hwb{\ttfamily \mbox{]}(\href{https://en.wikipedia.org/wiki/HWB_color_model}{\texttt{ https\+://en.\+wikipedia.\+org/wiki/\+HWB\+\_\+color\+\_\+model}}) -\/ Example\+:}chalk.\+hwb(32, 0, 50).bold(\textquotesingle{}Orange!\textquotesingle{}){\ttfamily  -\/}ansi16{\ttfamily  -\/}ansi256\`{}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5056}{}\doxysubsection{Windows}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5056}
If you\textquotesingle{}re on Windows, do yourself a favor and use \href{http://cmder.net/}{\texttt{ {\ttfamily cmder}}} instead of {\ttfamily cmd.\+exe}.\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5057}{}\doxysubsection{Origin story}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5057}
\href{https://github.com/Marak/colors.js}{\texttt{ colors.\+js}} used to be the most popular string styling module, but it has serious deficiencies like extending {\ttfamily String.\+prototype} which causes all kinds of \href{https://github.com/yeoman/yo/issues/68}{\texttt{ problems}} and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5058}{}\doxysubsection{Related}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5058}

\begin{DoxyItemize}
\item \href{https://github.com/chalk/chalk-cli}{\texttt{ chalk-\/cli}} -\/ CLI for this module
\item \href{https://github.com/chalk/ansi-styles}{\texttt{ ansi-\/styles}} -\/ ANSI escape codes for styling strings in the terminal
\item \href{https://github.com/chalk/supports-color}{\texttt{ supports-\/color}} -\/ Detect whether a terminal supports color
\item \href{https://github.com/chalk/strip-ansi}{\texttt{ strip-\/ansi}} -\/ Strip ANSI escape codes
\item \href{https://github.com/chalk/strip-ansi-stream}{\texttt{ strip-\/ansi-\/stream}} -\/ Strip ANSI escape codes from a stream
\item \href{https://github.com/chalk/has-ansi}{\texttt{ has-\/ansi}} -\/ Check if a string has ANSI escape codes
\item \href{https://github.com/chalk/ansi-regex}{\texttt{ ansi-\/regex}} -\/ Regular expression for matching ANSI escape codes
\item \href{https://github.com/chalk/wrap-ansi}{\texttt{ wrap-\/ansi}} -\/ Wordwrap a string with ANSI escape codes
\item \href{https://github.com/chalk/slice-ansi}{\texttt{ slice-\/ansi}} -\/ Slice a string with ANSI escape codes
\item \href{https://github.com/qix-/color-convert}{\texttt{ color-\/convert}} -\/ Converts colors between different models
\item \href{https://github.com/bokub/chalk-animation}{\texttt{ chalk-\/animation}} -\/ Animate strings in the terminal
\item \href{https://github.com/bokub/gradient-string}{\texttt{ gradient-\/string}} -\/ Apply color gradients to strings
\item \href{https://github.com/LitoMore/chalk-pipe}{\texttt{ chalk-\/pipe}} -\/ Create chalk style schemes with simpler style strings
\item \href{https://github.com/sindresorhus/terminal-link}{\texttt{ terminal-\/link}} -\/ Create clickable links in the terminal
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5059}{}\doxysubsection{Maintainers}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5059}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus}{\texttt{ Sindre Sorhus}}
\item \href{https://github.com/qix-}{\texttt{ Josh Junon}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_chalk_readme_autotoc_md5060}{}\doxysubsection{License}\label{md_sfcode_node_modules_chalk_readme_autotoc_md5060}
MIT 