\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/r/chalk/chalk?branch=master}{\texttt{ }} \href{https://www.youtube.com/watch?v=9auOCbH5Ns4}{\texttt{ }}

\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}}. Although there are other ones, they either do too much or not enough.

{\bfseries{Chalk is a clean and focused alternative.}}

\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22675}{}\doxysubsection{Why}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22675}

\begin{DoxyItemize}
\item Highly performant
\item Doesn\textquotesingle{}t extend {\ttfamily String.\+prototype}
\item Expressive API
\item Ability to nest styles
\item Clean and focused
\item Auto-\/detects color support
\item Actively maintained
\item \href{https://www.npmjs.com/browse/depended/chalk}{\texttt{ Used by $\sim$4500 modules}} as of July 15, 2015
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22676}{}\doxysubsection{Install}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22676}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/-\/save chalk }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22677}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22677}
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.


\begin{DoxyCode}{0}
\DoxyCodeLine{var chalk = require('chalk');}
\DoxyCodeLine{}
\DoxyCodeLine{// style a string}
\DoxyCodeLine{chalk.blue('Hello world!');}
\DoxyCodeLine{}
\DoxyCodeLine{// combine styled and normal strings}
\DoxyCodeLine{chalk.blue('Hello') + 'World' + chalk.red('!');}
\DoxyCodeLine{}
\DoxyCodeLine{// compose multiple styles using the chainable API}
\DoxyCodeLine{chalk.blue.bgRed.bold('Hello world!');}
\DoxyCodeLine{}
\DoxyCodeLine{// pass in multiple arguments}
\DoxyCodeLine{chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz');}
\DoxyCodeLine{}
\DoxyCodeLine{// nest styles}
\DoxyCodeLine{chalk.red('Hello', chalk.underline.bgBlue('world') + '!');}
\DoxyCodeLine{}
\DoxyCodeLine{// nest styles of the same type even (color, underline, background)}
\DoxyCodeLine{chalk.green(}
\DoxyCodeLine{    'I am a green line ' +}
\DoxyCodeLine{    chalk.blue.underline.bold('with a blue substring') +}
\DoxyCodeLine{    ' that becomes green again!'}
\DoxyCodeLine{); }

\end{DoxyCode}


Easily define your own themes.


\begin{DoxyCode}{0}
\DoxyCodeLine{var chalk = require('chalk');}
\DoxyCodeLine{var error = chalk.bold.red;}
\DoxyCodeLine{console.log(error('Error!')); }

\end{DoxyCode}


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


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

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22678}{}\doxysubsection{API}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22678}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22679}{}\doxysubsubsection{chalk.$<$tt$>$$<$style$>$\mbox{[}.$<$style$>$...\mbox{]}(string, \mbox{[}string...\mbox{]})$<$/tt$>$}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22679}
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_protractor_node_modules_chalk_readme_autotoc_md22680}{}\doxysubsubsection{chalk.\+enabled}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22680}
Color support is automatically detected, but you can override it by setting the {\ttfamily enabled} 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{var ctx = new chalk.constructor(\{enabled: false\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22681}{}\doxysubsubsection{chalk.\+supports\+Color}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22681}
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 an environment variable {\ttfamily FORCE\+\_\+\+COLOR} with any value to force color. Trumps {\ttfamily -\/-\/no-\/color}.\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22682}{}\doxysubsubsection{chalk.\+styles}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22682}
Exposes the styles as \href{https://github.com/chalk/ansi-styles}{\texttt{ ANSI escape codes}}.

Generally not useful, but you might need just the {\ttfamily .open} or {\ttfamily .close} escape code if you\textquotesingle{}re mixing externally styled strings with your own.


\begin{DoxyCode}{0}
\DoxyCodeLine{var chalk = require('chalk');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(chalk.styles.red);}
\DoxyCodeLine{//=> \{open: '\(\backslash\)u001b[31m', close: '\(\backslash\)u001b[39m'\}}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22683}{}\doxysubsubsection{chalk.\+has\+Color(string)}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22683}
Check whether a string \href{https://github.com/chalk/has-ansi}{\texttt{ has color}}.\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22684}{}\doxysubsubsection{chalk.\+strip\+Color(string)}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22684}
\href{https://github.com/chalk/strip-ansi}{\texttt{ Strip color}} from a string.

Can be useful in combination with {\ttfamily .supports\+Color} to strip color on externally styled text when it\textquotesingle{}s not supported.

Example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var chalk = require('chalk');}
\DoxyCodeLine{var styledString = getText();}
\DoxyCodeLine{}
\DoxyCodeLine{if (!chalk.supportsColor) \{}
\DoxyCodeLine{    styledString = chalk.stripColor(styledString);}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22685}{}\doxysubsection{Styles}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22685}
\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22686}{}\doxysubsubsection{Modifiers}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22686}

\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$
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22687}{}\doxysubsubsection{Colors}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22687}

\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 as normal blue is illegible)$\ast$
\item {\ttfamily magenta}
\item {\ttfamily cyan}
\item {\ttfamily white}
\item {\ttfamily gray}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22688}{}\doxysubsubsection{Background colors}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22688}

\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}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22689}{}\doxysubsection{256-\/colors}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22689}
Chalk does not support anything other than the base eight colors, which guarantees it will work on all terminals and systems. Some terminals, specifically {\ttfamily xterm} compliant ones, will support the full range of 8-\/bit colors. For this the lower level \href{https://github.com/jbnicolai/ansi-256-colors}{\texttt{ ansi-\/256-\/colors}} package can be used.\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22690}{}\doxysubsection{Windows}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22690}
If you\textquotesingle{}re on Windows, do yourself a favor and use \href{http://bliker.github.io/cmder/}{\texttt{ {\ttfamily cmder}}} instead of {\ttfamily cmd.\+exe}.\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22691}{}\doxysubsection{Related}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22691}

\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/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
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22692}{}\doxysubsection{License}\label{md_sfcode_node_modules_protractor_node_modules_chalk_readme_autotoc_md22692}
MIT © \href{http://sindresorhus.com}{\texttt{ Sindre Sorhus}} 