\href{https://npmjs.com/package/chartjs-color}{\texttt{ }} \href{https://travis-ci.org/chartjs/chartjs-color}{\texttt{ }}

\begin{quote}
Java\+Script library for color conversion and manipulation with support for CSS color strings. \end{quote}

\begin{DoxyCode}{0}
\DoxyCodeLine{var color = Color("{}\#7743CE"{});}
\DoxyCodeLine{}
\DoxyCodeLine{color.alpha(0.5).lighten(0.5);}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(color.hslString());  // "{}hsla(262, 59\%, 81\%, 0.5)"{} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5076}{}\doxysection{Install}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5076}

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

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

\begin{DoxyCode}{0}
\DoxyCodeLine{var Color = require("{}color"{}) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5078}{}\doxysubsection{Setters}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5078}

\begin{DoxyCode}{0}
\DoxyCodeLine{var color = Color("{}rgb(255, 255, 255)"{})}
\DoxyCodeLine{var color = Color(\{r: 255, g: 255, b: 255\})}
\DoxyCodeLine{var color = Color().rgb(255, 255, 255)}
\DoxyCodeLine{var color = Color().rgb([255, 255, 255]) }

\end{DoxyCode}
 Pass any valid CSS color string into {\ttfamily Color()} or a hash of values. Also load in color values with {\ttfamily rgb()}, {\ttfamily hsl()}, {\ttfamily hsv()}, {\ttfamily hwb()}, and {\ttfamily cmyk()}.


\begin{DoxyCode}{0}
\DoxyCodeLine{color.red(120) }

\end{DoxyCode}
 Set the values for individual channels with {\ttfamily alpha}, {\ttfamily red}, {\ttfamily green}, {\ttfamily blue}, {\ttfamily hue}, {\ttfamily saturation} (hsl), {\ttfamily saturationv} (hsv), {\ttfamily lightness}, {\ttfamily whiteness}, {\ttfamily blackness}, {\ttfamily cyan}, {\ttfamily magenta}, {\ttfamily yellow}, {\ttfamily black}\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5079}{}\doxysubsection{Getters}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5079}

\begin{DoxyCode}{0}
\DoxyCodeLine{color.rgb()       // \{r: 255, g: 255, b: 255\} }

\end{DoxyCode}
 Get a hash of the rgb values with {\ttfamily rgb()}, similarly for {\ttfamily hsl()}, {\ttfamily hsv()}, and {\ttfamily cmyk()}


\begin{DoxyCode}{0}
\DoxyCodeLine{color.rgbArray()  // [255, 255, 255] }

\end{DoxyCode}
 Get an array of the values with {\ttfamily rgb\+Array()}, {\ttfamily hsl\+Array()}, {\ttfamily hsv\+Array()}, and {\ttfamily cmyk\+Array()}.


\begin{DoxyCode}{0}
\DoxyCodeLine{color.red()       // 255 }

\end{DoxyCode}
 Get the value for an individual channel.\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5080}{}\doxysubsection{CSS Strings}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5080}

\begin{DoxyCode}{0}
\DoxyCodeLine{color.hslString()  // "{}hsl(320, 50\%, 100\%)"{} }

\end{DoxyCode}


Different CSS String formats for the color are on {\ttfamily hex\+String}, {\ttfamily rgb\+String}, {\ttfamily percent\+String}, {\ttfamily hsl\+String}, {\ttfamily hwb\+String}, and {\ttfamily keyword} (undefined if it\textquotesingle{}s not a keyword color). {\ttfamily \char`\"{}rgba\char`\"{}} and {\ttfamily \char`\"{}hsla\char`\"{}} are used if the current alpha value of the color isn\textquotesingle{}t {\ttfamily 1}.\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5081}{}\doxysubsection{Luminosity}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5081}

\begin{DoxyCode}{0}
\DoxyCodeLine{color.luminosity();  // 0.412 }

\end{DoxyCode}
 The \href{http://www.w3.org/TR/WCAG20/\#relativeluminancedef}{\texttt{ WCAG luminosity}} of the color. 0 is black, 1 is white.


\begin{DoxyCode}{0}
\DoxyCodeLine{color.contrast(Color("{}blue"{}))  // 12 }

\end{DoxyCode}
 The \href{http://www.w3.org/TR/WCAG20/\#contrast-ratiodef}{\texttt{ WCAG contrast ratio}} to another color, from 1 (same color) to 21 (contrast b/w white and black).


\begin{DoxyCode}{0}
\DoxyCodeLine{color.light();  // true}
\DoxyCodeLine{color.dark();   // false }

\end{DoxyCode}
 Get whether the color is \char`\"{}light\char`\"{} or \char`\"{}dark\char`\"{}, useful for deciding text color.\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5082}{}\doxysubsection{Manipulation}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5082}

\begin{DoxyCode}{0}
\DoxyCodeLine{color.negate()         // rgb(0, 100, 255) -\/> rgb(255, 155, 0)}
\DoxyCodeLine{}
\DoxyCodeLine{color.lighten(0.5)     // hsl(100, 50\%, 50\%) -\/> hsl(100, 50\%, 75\%)}
\DoxyCodeLine{color.darken(0.5)      // hsl(100, 50\%, 50\%) -\/> hsl(100, 50\%, 25\%)}
\DoxyCodeLine{}
\DoxyCodeLine{color.saturate(0.5)    // hsl(100, 50\%, 50\%) -\/> hsl(100, 75\%, 50\%)}
\DoxyCodeLine{color.desaturate(0.5)  // hsl(100, 50\%, 50\%) -\/> hsl(100, 25\%, 50\%)}
\DoxyCodeLine{color.greyscale()      // \#5CBF54 -\/> \#969696}
\DoxyCodeLine{}
\DoxyCodeLine{color.whiten(0.5)      // hwb(100, 50\%, 50\%) -\/> hwb(100, 75\%, 50\%)}
\DoxyCodeLine{color.blacken(0.5)     // hwb(100, 50\%, 50\%) -\/> hwb(100, 50\%, 75\%)}
\DoxyCodeLine{}
\DoxyCodeLine{color.clearer(0.5)     // rgba(10, 10, 10, 0.8) -\/> rgba(10, 10, 10, 0.4)}
\DoxyCodeLine{color.opaquer(0.5)     // rgba(10, 10, 10, 0.8) -\/> rgba(10, 10, 10, 1.0)}
\DoxyCodeLine{}
\DoxyCodeLine{color.rotate(180)      // hsl(60, 20\%, 20\%) -\/> hsl(240, 20\%, 20\%)}
\DoxyCodeLine{color.rotate(-\/90)      // hsl(60, 20\%, 20\%) -\/> hsl(330, 20\%, 20\%)}
\DoxyCodeLine{}
\DoxyCodeLine{color.mix(Color("{}yellow"{}))        // cyan -\/> rgb(128, 255, 128)}
\DoxyCodeLine{color.mix(Color("{}yellow"{}), 0.3)   // cyan -\/> rgb(77, 255, 179)}
\DoxyCodeLine{}
\DoxyCodeLine{// chaining}
\DoxyCodeLine{color.green(100).greyscale().lighten(0.6) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5083}{}\doxysubsection{Clone}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5083}
You can can create a copy of an existing color object using {\ttfamily clone()}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{color.clone() // -\/> New color object }

\end{DoxyCode}


And more to come...\hypertarget{md_sfcode_node_modules_chartjs_color_README_autotoc_md5084}{}\doxysection{Propers}\label{md_sfcode_node_modules_chartjs_color_README_autotoc_md5084}
The API was inspired by \href{https://github.com/brehaut/color-js}{\texttt{ color-\/js}}. Manipulation functions by CSS tools like Sass, LESS, and Stylus. 