\begin{quote}
\href{https://en.wikipedia.org/wiki/ANSI_escape_code\#Colors_and_Styles}{\texttt{ ANSI escape codes}} for styling strings in the terminal \end{quote}
You probably want the higher-\/level \href{https://github.com/chalk/chalk}{\texttt{ chalk}} module for styling your strings.

\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14932}{}\doxysection{Install}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14932}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install ansi-\/styles }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14933}{}\doxysection{Usage}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14933}

\begin{DoxyCode}{0}
\DoxyCodeLine{const style = require('ansi-\/styles');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(`\$\{style.green.open\}Hello world!\$\{style.green.close\}`);}
\DoxyCodeLine{}
\DoxyCodeLine{}
\DoxyCodeLine{// Color conversion between 16/256/truecolor}
\DoxyCodeLine{// NOTE: If conversion goes to 16 colors or 256 colors, the original color}
\DoxyCodeLine{//       may be degraded to fit that color palette. This means terminals}
\DoxyCodeLine{//       that do not support 16 million colors will best-\/match the}
\DoxyCodeLine{//       original color.}
\DoxyCodeLine{console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);}
\DoxyCodeLine{console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);}
\DoxyCodeLine{console.log(style.color.ansi16m.hex('\#abcdef') + 'Hello world!' + style.color.close); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14934}{}\doxysection{API}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14934}
Each style has an {\ttfamily open} and {\ttfamily close} property.\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14935}{}\doxysection{Styles}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14935}
\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14936}{}\doxysubsection{Modifiers}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14936}

\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_karma_node_modules_ansi_styles_readme_autotoc_md14937}{}\doxysubsection{Colors}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14937}

\begin{DoxyItemize}
\item {\ttfamily black}
\item {\ttfamily red}
\item {\ttfamily green}
\item {\ttfamily yellow}
\item {\ttfamily blue}
\item {\ttfamily magenta}
\item {\ttfamily cyan}
\item {\ttfamily white}
\item {\ttfamily black\+Bright} (alias\+: {\ttfamily gray}, {\ttfamily grey})
\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_karma_node_modules_ansi_styles_readme_autotoc_md14938}{}\doxysubsection{Background colors}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14938}

\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} (alias\+: {\ttfamily bg\+Gray}, {\ttfamily bg\+Grey})
\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_karma_node_modules_ansi_styles_readme_autotoc_md14939}{}\doxysection{Advanced usage}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14939}
By default, you get a map of styles, but the styles are also available as groups. They are non-\/enumerable so they don\textquotesingle{}t show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-\/level module.


\begin{DoxyItemize}
\item {\ttfamily style.\+modifier}
\item {\ttfamily style.\+color}
\item {\ttfamily style.\+bg\+Color}
\end{DoxyItemize}

\doxysubparagraph*{Example}


\begin{DoxyCode}{0}
\DoxyCodeLine{console.log(style.color.green.open); }

\end{DoxyCode}


Raw escape codes (i.\+e. without the CSI escape prefix {\ttfamily \textbackslash{}u001B\mbox{[}} and render mode postfix {\ttfamily m}) are available under {\ttfamily style.\+codes}, which returns a {\ttfamily Map} with the open codes as keys and close codes as values.

\doxysubparagraph*{Example}


\begin{DoxyCode}{0}
\DoxyCodeLine{console.log(style.codes.get(36));}
\DoxyCodeLine{//=> 39 }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14940}{}\doxysection{$<$a href=\char`\"{}https\+://gist.\+github.\+com/\+XVilka/8346728\char`\"{}$>$256 / 16 million (\+True\+Color) support$<$/a$>$}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14940}
{\ttfamily ansi-\/styles} uses the \href{https://github.com/Qix-/color-convert}{\texttt{ {\ttfamily color-\/convert}}} package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.

The following color spaces from {\ttfamily color-\/convert} are supported\+:


\begin{DoxyItemize}
\item {\ttfamily rgb}
\item {\ttfamily hex}
\item {\ttfamily keyword}
\item {\ttfamily hsl}
\item {\ttfamily hsv}
\item {\ttfamily hwb}
\item {\ttfamily ansi}
\item {\ttfamily ansi256}
\end{DoxyItemize}

To use these, call the associated conversion function with the intended output, for example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code}
\DoxyCodeLine{style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code}
\DoxyCodeLine{}
\DoxyCodeLine{style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code}
\DoxyCodeLine{style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code}
\DoxyCodeLine{}
\DoxyCodeLine{style.color.ansi16m.hex('\#C0FFEE'); // Hex (RGB) to 16 million color foreground code}
\DoxyCodeLine{style.bgColor.ansi16m.hex('\#C0FFEE'); // Hex (RGB) to 16 million color background code }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14941}{}\doxysection{Related}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14941}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/ansi-escapes}{\texttt{ ansi-\/escapes}} -\/ ANSI escape codes for manipulating the terminal
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14942}{}\doxysection{Maintainers}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14942}

\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_karma_node_modules_ansi_styles_readme_autotoc_md14943}{}\doxysection{For enterprise}\label{md_sfcode_node_modules_karma_node_modules_ansi_styles_readme_autotoc_md14943}
Available as part of the Tidelift Subscription.

The maintainers of {\ttfamily ansi-\/styles} and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. \href{https://tidelift.com/subscription/pkg/npm-ansi-styles?utm_source=npm-ansi-styles&utm_medium=referral&utm_campaign=enterprise&utm_term=repo}{\texttt{ Learn more.}} 