% \iffalse meta-comment % % Copyright (C) 2016 by Jerick Órdenes Sepúlveda % ------------------------------------------------------- % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in: % % http://www.latex-project.org/lppl.txt % % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % \fi % % \iffalse %<*driver> \ProvidesFile{xcolor-material.dtx} % %\NeedsTeXFormat{LaTeX2e}[2005/12/01] %\ProvidesPackage{xcolor-material} %[2016/10/11 v0.1 A package for accessing Google Material colors using the xcolor package] % %<*driver> \PassOptionsToClass{a4paper}{article} \documentclass{ltxdoc} \EnableCrossrefs \CodelineIndex \RecordChanges \usepackage{lmodern} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \PassOptionsToPackage{table}{xcolor} \usepackage{xcolor-material}[2016/10/11] \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \usepackage{tikz} \usepackage[stretch=10]{microtype} \usepackage{lstdoc} \makeatletter \def\@part[#1]#2{\ifhyper\phantomsection\fi \addcontentsline{toc}{part}{\sffamily #1}% {\parindent\z@ \raggedright \interlinepenalty\@M \sffamily \huge \bfseries \color{MaterialBlue700} #2\markboth{}{}\par}% \nobreak\vskip 3ex\@afterheading} \makeatother \hypersetup{linkcolor=MaterialRed600, urlcolor=MaterialPink600} \usepackage{cleveref} \newcommand*{\pkg}[1]{\textsf{#1}} \newcommand*{\opt}[1]{\texttt{#1}} \newcommand\xcolorpkg{\pkg{xcolor}} \newcommand\kvopkg{\pkg{kvoptions}} \newcommand\xmpkg{\pkg{xcolor-material}} \newcommand\google{{\sffamily{\color{GoogleBlue}G}{\color{GoogleRed}o}% {\color{GoogleYellow}o}{\color{GoogleBlue}g}{\color{GoogleGreen}l}{\color{GoogleRed}e}}} \newcommand\tikzpkg{PGF/Ti\textit{k}Z} \makeindex \begin{document} \DocInput{xcolor-material.dtx} \PrintChanges \PrintIndex \end{document} % % \fi % % \CheckSum{567} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % % \changes{v0.1}{2016/10/11}{Initial package version} % % \GetFileInfo{xcolor-material.sty} % % \DoNotIndex{\newcommand,\begin,\end,\bfseries,\sffamily,\ttfamily,\texttt, % \textbf,\emph,\auxcolor,\baselineskip,\color,\XCM@CMYKModel,\color,\colorval, % \colorbox,\parbox,\CurrentOption,\convertcolorspec,\DeclareDefaultOption, % \DeclareStringOption,\def,\edef,\definecolor,\else,\fi,\empty,\expandafter, % \#,\@ifpackageloaded,\extractcolorspecs,\extractedcolor,\first,\footnotesize, % \foreach,\gdef,\hspace,\i,\ifx,\model,\node,\OptionNotUsed,\PackageError, % \pgfkeys,\printcolorvalue,\ProcessKeyvalOptions,\raggedright, % \selectcolormodel,\textwidth,\tikzset,\usetikzlibrary,\variant,\vfill, % \vspace,\@ifnextchar} % % %\newbox\abstractbox %\setbox\abstractbox=\vbox{ % \begin{abstract} % The \xmpkg\ package is built on top of the great \xcolorpkg\ package. It % provides a useful definition of the beautiful \google\ Material % Color Palette, available at % \url{https://material.google.com/style/color.html}, for its use in document % writing with \LaTeX\ and Friends. % \end{abstract}} % \title{The \xmpkg\ package} % \author{Jerick Órdenes Sepúlveda \\ % <\href{mailto:os.jerick+xcolor-material@gmail.com}% % {os.jerick+xcolormaterial(at)gmail.com}>} % \date{\filedate~~ Version \fileversion\ \box\abstractbox} % % \csname @twocolumntrue\endcsname % \maketitle\thispagestyle{empty} % \csname @starttoc\endcsname{toc} % \onecolumn % % \part{Usage} % % \section{Installation} % % \subsection{Required Packages} % The \xmpkg\ package requires relatively updated packages. These packages are % \kvopkg\footnote{The \kvopkg\ package is available at % \url{https://www.ctan.org/pkg/kvoptions}} and \xcolorpkg\footnote{The % \xcolorpkg\ package is available at \url{https://www.ctan.org/pkg/xcolor}}, % which are included in any popular \TeX\ distribution. Both are loaded without % options. % % \subsection{Installing \xmpkg} % Once the \xmpkg\ package is released in \href{http://www.ctan.org}{CTAN}, % users should be able to install it from the \TeX\ distribution package manager % available in their PC. However, if you need to install this package % manually, you should run: % ^^A % \begin{verbatim} % latex xcolor-material.ins\end{verbatim} % ^^A % and copy the generated file |xcolor-material.sty| to a path where \LaTeX\ can % find it. To generate the documentation run the following % command twice. % ^^A % \begin{verbatim} % pdflatex xcolor-material.dtx\end{verbatim} % % \section{Loading \xmpkg} % Simply add the package declaration somewhere in the document preamble. % ^^A % \begin{verbatim} % \usepackage{xcolor-material}\end{verbatim} % % If you want to load the \kvopkg\ and \xcolorpkg\ packages with some % options, you can specify those options using the |\PassOptionsToPackage| % command \emph{before} loading \xmpkg, or by loading those packages with their % options \emph{before} loading the \xmpkg\ package. % % \subsection{Package Options} % The \xmpkg\ currently offers only one option, % \begin{description} % \item[\opt{prefix}|=|\meta{prefix}] Defines the prefix for all color names % defined in the Google Material Color Palette; this is used for namespacing % purposes. The default prefix is ``|Material|''. % \end{description} % The main purpose of this option is to avoid conflicts with other existent % color definitions. The |prefix| option allows custom prefix definition, e.g., % if you want to use the word `|myprefix|' as the color prefix, % then you must load the \xmpkg\ package with % ^^A % \begin{verbatim} % \usepackage[prefix=myprefix]{xcolor-material}\end{verbatim} % % \section{Using \xmpkg} % The \xmpkg\ provides all colors specified in the Google Material Color % Palette, available at \url{https://material.google.com/style/color.html}, in % the global scope of the document. This package relies on the \xcolorpkg\ % package, and you should refer to its documentation for more details % about using colors inside the document. % % \subsection{Color Names} % The Google Material Color Palette consists of 19 color palettes (each % for one base color) and two colors not included in any palette (|White| and % |Black|), together forming a list of 256 colors. Each individual palette % consists of 14 color variations of the base color, except for |Brown|, % |Grey|, and |Blue Grey| with 10. Every color variation has a number from the % list \texttt{\{50, 100, 200, 300, 400, 500, 600, 700, 800, 900\}} for the % first ten colors or \emph{primary palette}, and from the list \texttt{\{A100, % A200, A300, A400\}} for the last four or \emph{secondary palette}. The names % of the base colors and their variations are listed in table % \ref{tab:colornames}. For a complete list of these palettes go to the section % \ref{sec:colorpalettes}. % % \begin{table}[b!] % \centering % \caption{Color names from the Google Material Color Palette and their % variation palettes.} \label{tab:colornames} % \begin{tabular}{lc} % \hline % \textbf{Base Color} & \textbf{Palettes}\\ % \hline % \textcolor{MaterialRed}{|Red|} & primary, secondary\\ % \textcolor{MaterialPink}{|Pink|} & primary, secondary\\ % \textcolor{MaterialPurple}{|Purple|} & primary, secondary\\ % \textcolor{MaterialDeepPurple}{|Deep Purple|} & primary, secondary\\ % \textcolor{MaterialIndigo}{|Indigo|} & primary, secondary\\ % \textcolor{MaterialBlue}{|Blue|} & primary, secondary\\ % \textcolor{MaterialLightBlue}{|Light Blue|} & primary, secondary\\ % \textcolor{MaterialCyan}{|Cyan|} & primary, secondary\\ % \textcolor{MaterialTeal}{|Teal|} & primary, secondary\\ % \textcolor{MaterialGreen}{|Green|} & primary, secondary\\ % \textcolor{MaterialLightGreen}{|Light Green|} & primary, secondary\\ % \textcolor{MaterialLime}{|Lime|} & primary, secondary\\ % \textcolor{MaterialYellow}{|Yellow|} & primary, secondary\\ % \textcolor{MaterialAmber}{|Amber|} & primary, secondary\\ % \textcolor{MaterialOrange}{|Orange|} & primary, secondary\\ % \textcolor{MaterialDeepOrange}{|Deep Orange|} & primary, secondary\\ % \textcolor{MaterialBrown}{|Brown|} & secondary\\ % \textcolor{MaterialGrey}{|Grey|} & secondary\\ % \textcolor{MaterialBlueGrey}{|Blue Grey|} & secondary\\ % \textcolor{MaterialBlack}{|Black|} & ---\\ % \rowcolor{MaterialBlack}\textcolor{MaterialWhite}{|White|} & % \textcolor{MaterialWhite}{---}\\ % \hline % \end{tabular} %\end{table} % % The name under which the \xmpkg\ package defines each Google Material color % has the form `\meta{prefix}\meta{base name}\meta{variation}', where % \begin{itemize} % \item \meta{prefix} corresponds to the prefix set via the package option % |prefix|, % \item \meta{base name} is the official name of the base color (see table % \ref{tab:colornames}), and % \item \meta{variation} is the id number of the color variation, e.g., |50| % or |A100|. % \end{itemize} % For instance, by default (if a custom prefix is not defined), the |Blue 600| % color of the palette will be available in the document global scope as % ``|MaterialBlue600|''. Also, all base colors are representative of the % palettes' primary color and are available at the |500| variation or using % their color names, e.g., |MaterialBlue| or |MaterialBlue500| are the primary % color of the ``Material Blue Palette''. % % \subsection[Google Colors]{\google{} Colors} % The \xmpkg\ package provides the Google Identity colors, which definitions % are available in the Google Design Blog at % \url{https://design.google.com/articles/evolving-the-google-identity}. % The name under which these colors are defined has the form % `Google\meta{name}', where \meta{name} is a color name among % \textcolor{GoogleBlue}{|Blue|}, \textcolor{GoogleGreen}{|Green|}, % \textcolor{GoogleYellow}{|Yellow|}, and \textcolor{GoogleRed}{|Red|}. For % instance, if you want to use the Google Blue color you have to call for it % by using `|GoogleBlue|'.\\ % % \noindent % \colorsample{GoogleBlue} % \colorsample{GoogleGreen} % \colorsample{GoogleYellow} % \colorsample{GoogleRed}\\ % % \subsection{Useful macros} % The \xmpkg\ provides some useful macros for printing color values, samples, % and palettes. Some of them maybe rely on other LaTeX packages that are % not loaded by default. % % \noindent % \DescribeMacro{\printcolorvalue} % \oarg{color model}\marg{color name} % % This macro can be used to print any color value. It has one mandatory % argument \meta{color name}, which specifies the color name which you want % to know its value. And one optional argument, \meta{color model} that % corresponds to the color model in which the value will be presented: |HTML|, % |RGB| and |cmyk| (|HTML| by default). % \begin{table}[h!] % \centering % \begin{tabular}{lll} % |\printcolorvalue{MaterialBlue}| & & \textcolor{MaterialIndigo}{\printcolorvalue{MaterialBlue}}\\ % |\printcolorvalue[RGB]{MaterialGrey}| & & \textcolor{MaterialIndigo}{\printcolorvalue[RGB]{MaterialGrey}}\\ % |\printcolorvalue[cmyk]{orange}| & & \textcolor{MaterialIndigo}{\printcolorvalue[cmyk]{orange}}\\ % \end{tabular} %\end{table} % % \noindent % \DescribeMacro{\colorsample} % \oarg{color model}\oarg{text color}\oarg{box width}\marg{color name}\oarg{title} % % This macro allows you to draw color samples using a simple colorbox with % text. It has one mandatory argument % \begin{itemize} % \item \meta{color name} which is the name of the color to be drawn, % \end{itemize} % and four optional arguments: % \begin{itemize} % \item \meta{color model} represents the color model in which the color will % be presented (by default |HTML|), % \item \meta{text color} which specifies the color used for printing the % text (by default |white|), % \item \meta{box width} specifies the box width (by default is |6.5em|), if % it is \emph{empty} the default is passed, \item and \meta{title} which is % the title of the color sample, if this argument is not passed the color % name is taken. % \end{itemize} % % To generate samples of the \google\ Colors showed above we can type % \begin{verbatim} % \colorsample{GoogleBlue} \colorsample{GoogleGreen} % \colorsample{GoogleYellow} \colorsample{GoogleRed}\end{verbatim} % % Other samples: % ^^A % \begin{verbatim} % \colorsample[HTML][][black]{MaterialAmber50} % \colorsample{MaterialAmber} % \colorsample[RGB]{MaterialAmber600} % \colorsample{MaterialAmberA700}[Amber\\A700]\end{verbatim} % % \noindent % \colorsample[HTML][][black]{MaterialAmber50} % \colorsample{MaterialAmber} % \colorsample[RGB]{MaterialAmber600} % \colorsample{MaterialAmberA700}[Amber\\A700] % % \begin{verbatim} % \colorsample[cmyk][13em]{MaterialBlueGrey500} % \colorsample{purple}[\texttt{xcolor}\\ Purple] % \colorsample[RGB]{teal}[] % \end{verbatim} % % \noindent % \colorsample[cmyk][13em]{MaterialBlueGrey500} % \colorsample{purple}[\texttt{xcolor}\\ Purple] % \colorsample[RGB]{teal}[]\\ % % \noindent % \DescribeMacro{\colorpalette} % \oarg{key-value arguments}\marg{color name} % % This macro is available only if the \tikzpkg\ package is loaded. It provides % a simple way to draw the Google Material Color Palettes in the same way as we % can find them into the \href{https://material.google.com/style/color.html}{Google % Style Blog}. It has one mandatory argument \meta{color name}, which specifies % the palette base color that will be used to draw its variation palette. % Optional arguments are provided in the form of key-value arguments and key % styles. A complete list of key-value arguments and styles is available at % table \ref{tab:keyvalue} and \ref{tab:styles} respectively. The \xmpkg\ % package relies on the \textsf{pgfkeys} package to provide key-value % arguments, for deeper knowledge about how to use key-value arguments look at % package documentation\footnote{The \textsf{pgfkeys} package is available at % \url{https://www.ctan.org/pkg/pgfkeys}.}. % % \begin{table}[t!] % \centering\small % \caption{Key-value arguments for the \texttt{\textbackslash colorpalette} % macro.} \label{tab:keyvalue} % \rowcolors{2}{lightgray!20}{white} % \begin{tabular}{L{.3\textwidth}C{.25\textwidth}L{.35\textwidth}} % \hline % \multicolumn{1}{c}{\textbf{Key}} & \multicolumn{1}{c}{\textbf{Default}} % & \multicolumn{1}{c}{\textbf{Description}}\\ % \hline % |width| & .45 $\times$ |\textwidth| & Palette width\\ % |height| & 2 $\times$ |\baselineskip| & Variation colorbox height\\ % |shape| & rectangle & Variation colorbox shape\\ % |title| & \meta{color name} & Palette title\\ % |title text color| & white & Title colorbox text color\\ % |init text color| & black & Initial variation text color\\ % |altern text color| & white & Alternative variation text color\\ % |variation font| & sffamily & Variation title font\\ % |value font| & ttfamily & Variation value font\\ % |title font| & sffamily and bfseries & Palette title font\\ % |colorbox sep| & 0pt & Separation between % variation colorboxes\\ % |first colorbox sep| & .2 $\times$ |\baselineskip| & Separation between % title colorbox and first palette colorbox\\ % |title colorbox height| & 6 $\times$ |\baselineskip| & Height of the % title colorbox\\ % |primary palette| & \{50,100,200,\ldots,900\} & List of primary palette % variations \\ % |secondary palette| & \{A100,A200,A400,A700\} & List of secondary palette % variations\\ % |percent char| & \{\} & Character for color mixtures (usually |!|), this % is useful when the |basic| style is selected\\ % |primary variation| & 500 & Primary variation or palette's base color\\ % |primary toggle at| & 1000 & Color variation at which alternates between % |init text color| and |altern text color| for the primary palette\\ % |secondary toggle at| & 1000 & Color variation at which alternates % between |init text color| and |altern text color| for the secondary palette\\ % |color model| & HTML & Color Model to be used for printing the palette\\ % \hline % \end{tabular} % \end{table} % % \begin{table}[t!] % \centering\small % \caption{Style arguments for the \texttt{\textbackslash colorpalette} % macro.} \label{tab:styles} % \rowcolors{2}{lightgray!20}{white} % \begin{tabular}{C{.2\textwidth}L{.5\textwidth}} % \hline % \multicolumn{1}{c}{\textbf{Style}} & % \multicolumn{1}{c}{\textbf{Description}}\\ % \hline % |both| & Settings for printing both primary and secondary palettes % (Default)\\ % |primary| & For printing primary palette only \\ % |basic| & For printing variations from 10\,\% to 100\,\% of a base color\\ % \hline % \end{tabular} % \end{table} % % A printed palette is a stack of colorboxes that comprises three main % sections, one on top or |title colorbox| that is used for introducing the % palette with its primary variation, a |primary palette| in the middle and a % |secondary palette| at the bottom. With this macro, you can print out % all the palettes of the Google Material Colors, and with some configurations % you can print any color palette that you want in a fancy way as the Material % Palettes. % % For instance, the following commands produce a color palette for the % variations of the \xcolorpkg\ predefined |yellow| color between 10\,\% and % 100\,\%, and a custom palette by tricking the |\colorpalette| macro. % \begin{verbatim} % \colorpalette[basic, title text color=black]{yellow} % \colorpalette[primary palette={yellow,blue,red,gray,black,purple}, % secondary palette={yellow!20,blue!30,red!20,gray!40}, primary % variation=orange, primary toggle at=blue]{} %\end{verbatim} % % \noindent % \colorpalette[basic, title text color=black]{yellow}\hfill % \colorpalette[primary palette={yellow,blue,red,gray,black,purple}, % secondary palette={yellow!20,blue!30,red!20,gray!40}, primary % variation=orange, primary toggle at=blue, title=Predefined Orange]{} % % \subsection{Color Palettes}\label{sec:colorpalettes} % Here all Google Material Palettes are presented in the same way as they % appear at the Google Design blog using the |\colorpalette| command described % above. % % \begin{verbatim} % \colorpalette[primary toggle at=400, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialRed} % \colorpalette[primary toggle at=400, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialPink} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=400, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialRed}\hfill % \colorpalette[primary toggle at=400, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialPink} % \clearpage % % \begin{verbatim} % \colorpalette[primary toggle at=300, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialPurple} % \colorpalette[primary toggle at=300, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialDeepPurple} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=300, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialPurple}\hfill % \colorpalette[primary toggle at=300, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialDeepOrange} % \clearpage % % \begin{verbatim} % \colorpalette[primary toggle at=500, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialBlue} % \colorpalette[primary toggle at=300, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialIndigo} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=500, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialBlue}\hfill % \colorpalette[primary toggle at=300, secondary toggle at=A200, secondary % palette={A100,A200,A400,A700}]{MaterialIndigo} % \clearpage % % \begin{verbatim} % \colorpalette[primary toggle at=600, secondary toggle at=A700, title text % color=black]{MaterialLightBlue} % \colorpalette[primary toggle at=700, title text color=black]{MaterialCyan} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=600, secondary toggle at=A700, title text % color=black]{MaterialLightBlue}\hfill % \colorpalette[primary toggle at=700, title text color=black]{MaterialCyan} % \clearpage % % \begin{verbatim} % \colorpalette[primary toggle at=500, secondary % palette={A100,A200,A400,A700}]{MaterialTeal} % \colorpalette[primary toggle at=600, title text color=black]{MaterialGreen} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=500, secondary % palette={A100,A200,A400,A700}]{MaterialTeal}\hfill % \colorpalette[primary toggle at=600, title text color=black]{MaterialGreen} % \clearpage % % \begin{verbatim} % \colorpalette[primary toggle at=700, title text % color=black]{MaterialLightGreen} % \colorpalette[primary toggle at=900, title text color=black]{MaterialLime} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=700, title text % color=black]{MaterialLightGreen}\hfill % \colorpalette[primary toggle at=900, title text color=black]{MaterialLime} % \clearpage % % \begin{verbatim} % \colorpalette[title text color=black]{MaterialYellow} % \colorpalette[title text color=black]{MaterialAmber} % \end{verbatim} % % \noindent % \colorpalette[title text color=black]{MaterialYellow}\hfill % \colorpalette[title text color=black]{MaterialAmber} % \clearpage % % \begin{verbatim} % \colorpalette[primary toggle at=800, title text color=black]{MaterialOrange} % \colorpalette[primary toggle at=500, secondary toggle % at=A400]{MaterialDeepOrange} % \end{verbatim} % % \noindent % \colorpalette[primary toggle at=800, title text % color=black]{MaterialOrange}\hfill % \colorpalette[primary toggle at=500, secondary toggle % at=A400]{MaterialDeepOrange} % \clearpage % % \begin{verbatim} % \colorpalette[primary, primary toggle at=300]{MaterialBrown} % \colorpalette[primary, primary toggle at=600]{MaterialGrey} % \end{verbatim} % % \noindent % \colorpalette[primary, primary toggle at=300]{MaterialBrown}\hfill % \colorpalette[primary, primary toggle at=600]{MaterialGrey} % \clearpage % % \begin{verbatim} % \colorpalette[primary, primary toggle at=400]{MaterialBlueGrey} % \end{verbatim} % % \noindent % \colorpalette[primary, primary toggle at=400]{MaterialBlueGrey} % % \section{Bug reports} % The development version of this package is available at % \url{https://github.com/OSjerick/xcolor-material}. If you find bugs, have % feature suggestions or think of ways in which the \xmpkg\ package and its % documentation could be improved, please open a ticket in the GitHub % repository's issue tracker. % % \section{Acknowledgements} % This package was inspired by the \textsf{xcolor-solarized} package, available % at \url{https://www.ctan.org/pkg/xcolor-solarized}, then I have to thank % Julien Cretel its creator. Also, thanks to \google\ for such amazing color % palette. % % \StopEventually{That's all!} % \clearpage % \part{Implementation} % % I have used the word `|XCM|' followed by an `|@|' character for namespacing % purposes into the \xmpkg\ package source. % % \section{Required Packages} % The \xmpkg\ requires the \xcolorpkg\ and \kvopkg\ packages, both are % loaded without any option. % % \begin{macrocode} \RequirePackage{xcolor}[2007/01/21] \RequirePackage{kvoptions}[2011/06/30] % \end{macrocode} % % The \xcolorpkg\ package is used to define and provide every single color in % the \google\ Material Color Palette. The \kvopkg\ package supports package % options in a key-value format. % % \section{Package Options} % Setting up \kvopkg\ configuration. % % \begin{macrocode} \SetupKeyvalOptions{ family=XCM, prefix=XCM@ } % \end{macrocode} % % Declaring string option key `|prefix|': % % \begin{macrocode} \DeclareStringOption[Material]{prefix}[Material] \DeclareDefaultOption{ \OptionNotUsed \PackageError{xcolor-material}{Unknown `\CurrentOption' option.} } \ProcessKeyvalOptions* % \end{macrocode} % % Note that the default value for this key is `|Material|'. Note also that this % package checks for valid options, if an invalid option is passed, a % PackageError will be thrown. % % \section{Color Definitions} % % \begin{macro}{\XCM@definecolor} % I have taken the idea from the \textsf{xcolor-solarized} package of having a % convenient internal macro for color definitions. % \begin{macrocode} \newcommand{\XCM@definecolor}[2] {\expandafter\definecolor\expandafter{\XCM@prefix #1}{HTML}{#2}} % \end{macrocode} % \end{macro} % % Using this macro definition we can define all the \google\ Material colors % as follows. Note that for every color in the palette, the |500| % variation is the base color default as \google\ recommends for primary colors. % % \subsection{Red} % \begin{macrocode} \XCM@definecolor{Red50} {FFEBEE} \XCM@definecolor{Red100} {FFCDD2} \XCM@definecolor{Red200} {EF9A9A} \XCM@definecolor{Red300} {E57373} \XCM@definecolor{Red400} {EF5350} \XCM@definecolor{Red500} {F44336} \XCM@definecolor{Red600} {E53935} \XCM@definecolor{Red700} {D32F2F} \XCM@definecolor{Red800} {C62828} \XCM@definecolor{Red900} {B71C1C} \XCM@definecolor{RedA100}{FF8A80} \XCM@definecolor{RedA200}{FF5252} \XCM@definecolor{RedA400}{FF1744} \XCM@definecolor{RedA700}{D50000} \definecolor{\XCM@prefix Red}{named}{\XCM@prefix Red500} % \end{macrocode} % % \subsection{Pink} % \begin{macrocode} \XCM@definecolor{Pink50} {FCE4EC} \XCM@definecolor{Pink100} {F8BBD0} \XCM@definecolor{Pink200} {F48FB1} \XCM@definecolor{Pink300} {F06292} \XCM@definecolor{Pink400} {EC407A} \XCM@definecolor{Pink500} {E91E63} \XCM@definecolor{Pink600} {D81B60} \XCM@definecolor{Pink700} {C2185B} \XCM@definecolor{Pink800} {AD1457} \XCM@definecolor{Pink900} {880E4F} \XCM@definecolor{PinkA100}{FF80AB} \XCM@definecolor{PinkA200}{FF4081} \XCM@definecolor{PinkA400}{F50057} \XCM@definecolor{PinkA700}{C51162} \definecolor{\XCM@prefix Pink}{named}{\XCM@prefix Pink500} % \end{macrocode} % % \subsection{Purple} % \begin{macrocode} \XCM@definecolor{Purple50} {F3E5F5} \XCM@definecolor{Purple100} {E1BEE7} \XCM@definecolor{Purple200} {CE93D8} \XCM@definecolor{Purple300} {BA68C8} \XCM@definecolor{Purple400} {AB47BC} \XCM@definecolor{Purple500} {9C27B0} \XCM@definecolor{Purple600} {8E24AA} \XCM@definecolor{Purple700} {7B1FA2} \XCM@definecolor{Purple800} {6A1B9A} \XCM@definecolor{Purple900} {4A148C} \XCM@definecolor{PurpleA100}{EA80FC} \XCM@definecolor{PurpleA200}{E040FB} \XCM@definecolor{PurpleA400}{D500F9} \XCM@definecolor{PurpleA700}{AA00FF} \definecolor{\XCM@prefix Purple}{named}{\XCM@prefix Purple500} % \end{macrocode} % % \subsection{Deep Purple} % \begin{macrocode} \XCM@definecolor{DeepPurple50} {EDE7F6} \XCM@definecolor{DeepPurple100} {D1C4E9} \XCM@definecolor{DeepPurple200} {B39DDB} \XCM@definecolor{DeepPurple300} {9575CD} \XCM@definecolor{DeepPurple400} {7E57C2} \XCM@definecolor{DeepPurple500} {673AB7} \XCM@definecolor{DeepPurple600} {5E35B1} \XCM@definecolor{DeepPurple700} {512DA8} \XCM@definecolor{DeepPurple800} {4527A0} \XCM@definecolor{DeepPurple900} {311B92} \XCM@definecolor{DeepPurpleA100}{B388FF} \XCM@definecolor{DeepPurpleA200}{7C4DFF} \XCM@definecolor{DeepPurpleA400}{651FFF} \XCM@definecolor{DeepPurpleA700}{6200EA} \definecolor{\XCM@prefix DeepPurple}{named}{\XCM@prefix DeepPurple500} % \end{macrocode} % % \subsection{Indigo} % \begin{macrocode} \XCM@definecolor{Indigo50} {E8EAF6} \XCM@definecolor{Indigo100} {C5CAE9} \XCM@definecolor{Indigo200} {9FA8DA} \XCM@definecolor{Indigo300} {7986CB} \XCM@definecolor{Indigo400} {5C6BC0} \XCM@definecolor{Indigo500} {3F51B5} \XCM@definecolor{Indigo600} {3949AB} \XCM@definecolor{Indigo700} {303F9F} \XCM@definecolor{Indigo800} {283593} \XCM@definecolor{Indigo900} {1A237E} \XCM@definecolor{IndigoA100}{8C9EFF} \XCM@definecolor{IndigoA200}{536DFE} \XCM@definecolor{IndigoA400}{3D5AFE} \XCM@definecolor{IndigoA700}{304FFE} \definecolor{\XCM@prefix Indigo}{named}{\XCM@prefix Indigo500} % \end{macrocode} % % \subsection{Blue} % \begin{macrocode} \XCM@definecolor{Blue50} {E3F2FD} \XCM@definecolor{Blue100} {BBDEFB} \XCM@definecolor{Blue200} {90CAF9} \XCM@definecolor{Blue300} {64B5F6} \XCM@definecolor{Blue400} {42A5F5} \XCM@definecolor{Blue500} {2196F3} \XCM@definecolor{Blue600} {1E88E5} \XCM@definecolor{Blue700} {1976D2} \XCM@definecolor{Blue800} {1565C0} \XCM@definecolor{Blue900} {0D47A1} \XCM@definecolor{BlueA100}{82B1FF} \XCM@definecolor{BlueA200}{448AFF} \XCM@definecolor{BlueA400}{2979FF} \XCM@definecolor{BlueA700}{2962FF} \definecolor{\XCM@prefix Blue}{named}{\XCM@prefix Blue500} % \end{macrocode} % % \subsection{Light Blue} % \begin{macrocode} \XCM@definecolor{LightBlue50} {E1F5FE} \XCM@definecolor{LightBlue100} {B3E5FC} \XCM@definecolor{LightBlue200} {81D4FA} \XCM@definecolor{LightBlue300} {4FC3F7} \XCM@definecolor{LightBlue400} {29B6F6} \XCM@definecolor{LightBlue500} {03A9F4} \XCM@definecolor{LightBlue600} {039BE5} \XCM@definecolor{LightBlue700} {0288D1} \XCM@definecolor{LightBlue800} {0277BD} \XCM@definecolor{LightBlue900} {01579B} \XCM@definecolor{LightBlueA100}{80D8FF} \XCM@definecolor{LightBlueA200}{40C4FF} \XCM@definecolor{LightBlueA400}{00B0FF} \XCM@definecolor{LightBlueA700}{0091EA} \definecolor{\XCM@prefix LightBlue}{named}{\XCM@prefix LightBlue500} % \end{macrocode} % % \subsection{Cyan} % \begin{macrocode} \XCM@definecolor{Cyan50} {E0F7FA} \XCM@definecolor{Cyan100} {B2EBF2} \XCM@definecolor{Cyan200} {80DEEA} \XCM@definecolor{Cyan300} {4DD0E1} \XCM@definecolor{Cyan400} {26C6DA} \XCM@definecolor{Cyan500} {00BCD4} \XCM@definecolor{Cyan600} {00ACC1} \XCM@definecolor{Cyan700} {0097A7} \XCM@definecolor{Cyan800} {00838F} \XCM@definecolor{Cyan900} {006064} \XCM@definecolor{CyanA100}{84FFFF} \XCM@definecolor{CyanA200}{18FFFF} \XCM@definecolor{CyanA400}{00E5FF} \XCM@definecolor{CyanA700}{00B8D4} \definecolor{\XCM@prefix Cyan}{named}{\XCM@prefix Cyan500} % \end{macrocode} % % \subsection{Teal} % \begin{macrocode} \XCM@definecolor{Teal50} {E0F2F1} \XCM@definecolor{Teal100} {B2DFDB} \XCM@definecolor{Teal200} {80CBC4} \XCM@definecolor{Teal300} {4DB6AC} \XCM@definecolor{Teal400} {26A69A} \XCM@definecolor{Teal500} {009688} \XCM@definecolor{Teal600} {00897B} \XCM@definecolor{Teal700} {00796B} \XCM@definecolor{Teal800} {00695C} \XCM@definecolor{Teal900} {004D40} \XCM@definecolor{TealA100}{A7FFEB} \XCM@definecolor{TealA200}{64FFDA} \XCM@definecolor{TealA400}{1DE9B6} \XCM@definecolor{TealA700}{00BFA5} \definecolor{\XCM@prefix Teal}{named}{\XCM@prefix Teal500} % \end{macrocode} % % \subsection{Green} % \begin{macrocode} \XCM@definecolor{Green50} {E8F5E9} \XCM@definecolor{Green100} {C8E6C9} \XCM@definecolor{Green200} {A5D6A7} \XCM@definecolor{Green300} {81C784} \XCM@definecolor{Green400} {66BB6A} \XCM@definecolor{Green500} {4CAF50} \XCM@definecolor{Green600} {43A047} \XCM@definecolor{Green700} {388E3C} \XCM@definecolor{Green800} {2E7D32} \XCM@definecolor{Green900} {1B5E20} \XCM@definecolor{GreenA100}{B9F6CA} \XCM@definecolor{GreenA200}{69F0AE} \XCM@definecolor{GreenA400}{00E676} \XCM@definecolor{GreenA700}{00C853} \definecolor{\XCM@prefix Green}{named}{\XCM@prefix Green500} % \end{macrocode} % % \subsection{Light Green} % \begin{macrocode} \XCM@definecolor{LightGreen50} {F1F8E9} \XCM@definecolor{LightGreen100} {DCEDC8} \XCM@definecolor{LightGreen200} {C5E1A5} \XCM@definecolor{LightGreen300} {AED581} \XCM@definecolor{LightGreen400} {9CCC65} \XCM@definecolor{LightGreen500} {8BC34A} \XCM@definecolor{LightGreen600} {7CB342} \XCM@definecolor{LightGreen700} {689F38} \XCM@definecolor{LightGreen800} {558B2F} \XCM@definecolor{LightGreen900} {33691E} \XCM@definecolor{LightGreenA100}{CCFF90} \XCM@definecolor{LightGreenA200}{B2FF59} \XCM@definecolor{LightGreenA400}{76FF03} \XCM@definecolor{LightGreenA700}{64DD17} \definecolor{\XCM@prefix LightGreen}{named}{\XCM@prefix LightGreen500} % \end{macrocode} % % \subsection{Lime} % \begin{macrocode} \XCM@definecolor{Lime50} {F9FBE7} \XCM@definecolor{Lime100} {F0F4C3} \XCM@definecolor{Lime200} {E6EE9C} \XCM@definecolor{Lime300} {DCE775} \XCM@definecolor{Lime400} {D4E157} \XCM@definecolor{Lime500} {CDDC39} \XCM@definecolor{Lime600} {C0CA33} \XCM@definecolor{Lime700} {AFB42B} \XCM@definecolor{Lime800} {9E9D24} \XCM@definecolor{Lime900} {827717} \XCM@definecolor{LimeA100}{F4FF81} \XCM@definecolor{LimeA200}{EEFF41} \XCM@definecolor{LimeA400}{C6FF00} \XCM@definecolor{LimeA700}{AEEA00} \definecolor{\XCM@prefix Lime}{named}{\XCM@prefix Lime500} % \end{macrocode} % % \subsection{Yellow} % \begin{macrocode} \XCM@definecolor{Yellow50} {FFFDE7} \XCM@definecolor{Yellow100} {FFF9C4} \XCM@definecolor{Yellow200} {FFF59D} \XCM@definecolor{Yellow300} {FFF176} \XCM@definecolor{Yellow400} {FFEE58} \XCM@definecolor{Yellow500} {FFEB3B} \XCM@definecolor{Yellow600} {FDD835} \XCM@definecolor{Yellow700} {FBC02D} \XCM@definecolor{Yellow800} {F9A825} \XCM@definecolor{Yellow900} {F57F17} \XCM@definecolor{YellowA100}{FFFF8D} \XCM@definecolor{YellowA200}{FFFF00} \XCM@definecolor{YellowA400}{FFEA00} \XCM@definecolor{YellowA700}{FFD600} \definecolor{\XCM@prefix Yellow}{named}{\XCM@prefix Yellow500} % \end{macrocode} % % \subsection{Amber} % \begin{macrocode} \XCM@definecolor{Amber50} {FFF8E1} \XCM@definecolor{Amber100} {FFECB3} \XCM@definecolor{Amber200} {FFE082} \XCM@definecolor{Amber300} {FFD54F} \XCM@definecolor{Amber400} {FFCA28} \XCM@definecolor{Amber500} {FFC107} \XCM@definecolor{Amber600} {FFB300} \XCM@definecolor{Amber700} {FFA000} \XCM@definecolor{Amber800} {FF8F00} \XCM@definecolor{Amber900} {FF6F00} \XCM@definecolor{AmberA100}{FFE57F} \XCM@definecolor{AmberA200}{FFD740} \XCM@definecolor{AmberA400}{FFC400} \XCM@definecolor{AmberA700}{FFAB00} \definecolor{\XCM@prefix Amber}{named}{\XCM@prefix Amber500} % \end{macrocode} % % \subsection{Orange} % \begin{macrocode} \XCM@definecolor{Orange50} {FFF3E0} \XCM@definecolor{Orange100} {FFE0B2} \XCM@definecolor{Orange200} {FFCC80} \XCM@definecolor{Orange300} {FFB74D} \XCM@definecolor{Orange400} {FFA726} \XCM@definecolor{Orange500} {FF9800} \XCM@definecolor{Orange600} {FB8C00} \XCM@definecolor{Orange700} {F57C00} \XCM@definecolor{Orange800} {EF6C00} \XCM@definecolor{Orange900} {E65100} \XCM@definecolor{OrangeA100}{FFD180} \XCM@definecolor{OrangeA200}{FFAB40} \XCM@definecolor{OrangeA400}{FF9100} \XCM@definecolor{OrangeA700}{FF6D00} \definecolor{\XCM@prefix Orange}{named}{\XCM@prefix Orange500} % \end{macrocode} % % \subsection{Deep Orange} % \begin{macrocode} \XCM@definecolor{DeepOrange50} {FBE9E7} \XCM@definecolor{DeepOrange100} {FFCCBC} \XCM@definecolor{DeepOrange200} {FFAB91} \XCM@definecolor{DeepOrange300} {FF8A65} \XCM@definecolor{DeepOrange400} {FF7043} \XCM@definecolor{DeepOrange500} {FF5722} \XCM@definecolor{DeepOrange600} {F4511E} \XCM@definecolor{DeepOrange700} {E64A19} \XCM@definecolor{DeepOrange800} {D84315} \XCM@definecolor{DeepOrange900} {BF360C} \XCM@definecolor{DeepOrangeA100}{FF9E80} \XCM@definecolor{DeepOrangeA200}{FF6E40} \XCM@definecolor{DeepOrangeA400}{FF3D00} \XCM@definecolor{DeepOrangeA700}{DD2C00} \definecolor{\XCM@prefix DeepOrange}{named}{\XCM@prefix DeepOrange500} % \end{macrocode} % % \subsection{Brown} % \begin{macrocode} \XCM@definecolor{Brown50} {EFEBE9} \XCM@definecolor{Brown100}{D7CCC8} \XCM@definecolor{Brown200}{BCAAA4} \XCM@definecolor{Brown300}{A1887F} \XCM@definecolor{Brown400}{8D6E63} \XCM@definecolor{Brown500}{795548} \XCM@definecolor{Brown600}{6D4C41} \XCM@definecolor{Brown700}{5D4037} \XCM@definecolor{Brown800}{4E342E} \XCM@definecolor{Brown900}{3E2723} \definecolor{\XCM@prefix Brown}{named}{\XCM@prefix Brown500} % \end{macrocode} % % \subsection{Grey} % \begin{macrocode} \XCM@definecolor{Grey50} {FAFAFA} \XCM@definecolor{Grey100}{F5F5F5} \XCM@definecolor{Grey200}{EEEEEE} \XCM@definecolor{Grey300}{E0E0E0} \XCM@definecolor{Grey400}{BDBDBD} \XCM@definecolor{Grey500}{9E9E9E} \XCM@definecolor{Grey600}{757575} \XCM@definecolor{Grey700}{616161} \XCM@definecolor{Grey800}{424242} \XCM@definecolor{Grey900}{212121} \definecolor{\XCM@prefix Grey}{named}{\XCM@prefix Grey500} % \end{macrocode} % % \subsection{Blue Grey} % \begin{macrocode} \XCM@definecolor{BlueGrey50} {ECEFF1} \XCM@definecolor{BlueGrey100}{CFD8DC} \XCM@definecolor{BlueGrey200}{B0BEC5} \XCM@definecolor{BlueGrey300}{90A4AE} \XCM@definecolor{BlueGrey400}{78909C} \XCM@definecolor{BlueGrey500}{607D8B} \XCM@definecolor{BlueGrey600}{546E7A} \XCM@definecolor{BlueGrey700}{455A64} \XCM@definecolor{BlueGrey800}{37474F} \XCM@definecolor{BlueGrey900}{263238} \definecolor{\XCM@prefix BlueGrey}{named}{\XCM@prefix BlueGrey500} % \end{macrocode} % % \subsection{Black \& White} % \begin{macrocode} \XCM@definecolor{Black}{000000} \XCM@definecolor{White}{FFFFFF} % \end{macrocode} % % \subsection[Google colors]{\google\ colors} % The \google\ Indentity colors are available at % \url{https://design.google.com/articles/evolving-the-google-identity}. % \begin{macrocode} \definecolor{GoogleBlue} {HTML}{4285F4} \definecolor{GoogleGreen} {HTML}{34A853} \definecolor{GoogleYellow}{HTML}{FBBC05} \definecolor{GoogleRed} {HTML}{EA4335} % \end{macrocode} % % \section{User-level macros} % % \begin{macro}{\XCM@extractcolor} % An internal macro to extract and convert color values. % \begin{macrocode} \newcommand{\XCM@extractcolor}[2]{% \extractcolorspecs{#1}{\model}{\colorval}% \convertcolorspec{\model}{\colorval}{#2}\extractedcolor \extractedcolor } % \end{macrocode} % \end{macro} % \begin{macro}{\printcolorvalue} % A user level macro to provide color values formatted in three different color % models: \textbf{HTML}, \textbf{RGB}, and \textbf{CMYK}. The default value for % the color model is |HTML|, that provides color values in hexadecimal format. % \begin{macrocode} \newcommand*{\printcolorvalue}[2][HTML]{% \edef\XCM@requiredModel{#1}% \def\XCM@HTMLModel{HTML}% \def\XCM@RGBModel{RGB}% \def\XCM@CMYKModel{cmyk}% \ifx\XCM@requiredModel\XCM@HTMLModel \#\XCM@extractcolor{#2}{#1}% \else\ifx\XCM@requiredModel\XCM@RGBModel rgb(\XCM@extractcolor{#2}{#1})% \else\ifx\XCM@requiredModel\XCM@CMYKModel cmyk(\XCM@extractcolor{#2}{#1})% \else\fi\fi\fi } % \end{macrocode} % \end{macro} % \begin{macro}{\colorsample} % A user level macro for drawing color samples. It draws a |colorbox| with % the specified color and value. By default the color model is |HTML|, % the text color is |white|, and the colorbox width is |6.5em|. % \begin{macrocode} \def\colorsample{% \@ifnextchar[% {\XCM@colorsample@i} {\XCM@colorsample@i[HTML]}% } \def\XCM@colorsample@i[#1]{% \@ifnextchar[% {\XCM@colorsample@ii{#1}} {\XCM@colorsample@ii{#1}[6.5em]}% } \def\XCM@colorsample@ii#1[#2]{% \@ifnextchar[% {\XCM@colorsample@iii{#1}{#2}} {\XCM@colorsample@iii{#1}{#2}[white]}% } \def\XCM@colorsample@iii#1#2[#3]#4{% \@ifnextchar[% {\XCM@colorsample@iv{#1}{#2}{#3}{#4}} {\XCM@colorsample@iv{#1}{#2}{#3}{#4}[#4]}% } \def\XCM@colorsample@iv#1#2#3#4[#5]{% \def\XCM@temp{#2}\ifx\XCM@temp\empty \def\XCM@boxwidth{6.5em}% \else \def\XCM@boxwidth{#2}% \fi \selectcolormodel{#1} \colorbox{#4}{% \hspace*{.3em} \parbox[b][9\baselineskip]{\XCM@boxwidth}{% \footnotesize\bfseries\sffamily\color{#3} \vspace*{.7em} \raggedright#5% \vfill \raggedright\texttt{\printcolorvalue[#1]{#4}} \vspace*{.7em} } \hspace*{.3em} } } % \end{macrocode} % \end{macro} % \xmpkg\ provides some macro definitions at begin document. % \begin{macrocode} \AtBeginDocument{ % \end{macrocode} % There is a macro definition that is built on top of the \tikzpkg\ package. % This definition works if such package is loaded in the main document. % \begin{macrocode} \@ifpackageloaded{tikz}{% % \end{macrocode} % When \tikzpkg\ is loaded, a macro with key-value options is provided using % the |\pgfkeys| tools. Those key-value macro arguments are optional, the % default value of each one is defined by the |/palette/both| style. % \begin{macrocode} \pgfkeys{/palette/.is family, /palette, width/.estore in = \XCM@pltWidth, height/.estore in = \XCM@pltHeight, shape/.estore in = \XCM@pltShape, title/.estore in = \XCM@pltTitle, title text color/.estore in = \XCM@pltTTextColor, init text color/.estore in = \XCM@pltITextColor, altern text color/.estore in = \XCM@pltATextColor, variation font/.store in = \XCM@pltVFont, value font/.store in = \XCM@pltNFont, title font/.store in = \XCM@pltTFont, colorbox sep/.estore in = \XCM@pltColorboxSep, first colorbox sep/.estore in = \XCM@pltFirstCSep, title colorbox height/.estore in = \XCM@pltTitleHeight, primary palette/.estore in = \XCM@pltPrimary, secondary palette/.estore in = \XCM@pltSecondary, percent char/.estore in = \XCM@pltPercentSep, primary variation/.estore in = \XCM@pltPrimaryBase, primary toggle at/.estore in = \XCM@pltPToggle, secondary toggle at/.estore in = \XCM@pltSToggle, color model/.estore in = \XCM@ColorModel, both/.style = {width = .45\textwidth, height = 2\baselineskip, shape = rectangle, title text color = white, init text color = black, altern text color = white, colorbox sep = 0pt, first colorbox sep = .2\baselineskip, title colorbox height = 6\baselineskip, variation font = \sffamily, value font = \ttfamily, title font = \sffamily\bfseries, primary palette = {50,100,200,...,900}, secondary palette = {A100,A200,A400,A700}, percent char = {}, primary variation = 500, primary toggle at = 1000, secondary toggle at = 1000, color model = HTML}, primary/.style = {primary palette = {50,100,200,...,900}, secondary palette={}, primary variation = 500, percent char={}}, basic/.style = {primary palette = {10,20,...,100}, secondary palette={}, primary variation = 100, percent char=!} } % \end{macrocode} % The |positioning| library of \tikzpkg\ is loaded to provide convenient node % placement. % \begin{macrocode} \usetikzlibrary{positioning} % \end{macrocode} % \begin{macro}{\colorpalette} % A macro for drawing color palettes using \tikzpkg\. It takes one mandatory % argument (\emph{base color name}) and optional key-value arguments. % \begin{macrocode} \newcommand*{\colorpalette}[2][]{% \def\XCM@pltTitle{#2}% \def\XCM@colorname{#2}% \pgfkeys{/palette, both, #1}% \begin{tikzpicture} \selectcolormodel{\XCM@ColorModel} \tikzset{colorbox/.style={\XCM@pltShape, minimum width=\XCM@pltWidth, minimum height=\XCM@pltHeight, node distance=\XCM@pltColorboxSep, outer sep=0pt}} \tikzset{title/.style = {font=\XCM@pltTFont, color=\XCM@pltTTextColor, inner sep=1em}} \tikzset{variant/.style = {font=\XCM@pltVFont, inner sep=1em}} \tikzset{value/.style = {font=\XCM@pltNFont, inner sep=1em}} \node[colorbox, fill=\XCM@colorname\XCM@pltPercentSep\XCM@pltPrimaryBase, minimum height=\XCM@pltTitleHeight, alias=last] {}; \node[title, anchor=north west, align=left] at (last.north west) {\XCM@pltTitle}; \node[title, anchor=south west] at (last.south west) {\XCM@pltPrimaryBase}; \node[title, anchor=south east, align=right] at (last.south east) {\texttt{\printcolorvalue[\XCM@ColorModel]{\XCM@colorname% \XCM@pltPercentSep\XCM@pltPrimaryBase}}}; \def\auxcolor{\XCM@pltITextColor}% \def\first{1}% \foreach \variant [count=\i] in \XCM@pltPrimary { \ifx\i\first \node[node distance=\XCM@pltFirstCSep, inner sep=0pt, below=of last, alias=last] {}; \else\fi \ifx\variant\XCM@pltPToggle \gdef\auxcolor{\XCM@pltATextColor}% \else\fi \node[colorbox, fill=\XCM@colorname\XCM@pltPercentSep\variant, below=of last, alias=last] {}; \node[variant, anchor=west, color=\auxcolor] at (last.west) {\variant}; \node[value, anchor=east, color=\auxcolor, align=right] at (last.east) {\printcolorvalue[\XCM@ColorModel]{\XCM@colorname% \XCM@pltPercentSep\variant}}; }% \def\auxcolor{\XCM@pltITextColor}% \foreach \variant [count=\i] in \XCM@pltSecondary { \ifx\i\first \node[node distance=\XCM@pltFirstCSep, inner sep=0pt, below=of last, alias=last] {}; \else\fi \ifx\variant\XCM@pltSToggle \gdef\auxcolor{\XCM@pltATextColor}% \else\fi \node[colorbox, fill=\XCM@colorname\XCM@pltPercentSep\variant, below=of last, alias=last] {}; \node[variant, anchor=west, color=\auxcolor] at (last.west) {\variant}; \node[value, anchor=east, color=\auxcolor, align=right] at (last.east) {\printcolorvalue[\XCM@ColorModel]{\XCM@colorname% \XCM@pltPercentSep\variant}}; }% \end{tikzpicture}% } % \end{macrocode} % \end{macro} % \begin{macrocode} }{} } % \end{macrocode} % \Finale \endinput