Debian Codegraph @

texmf-dist/source/latex/xcolor-solarized/xcolor-solarized.dtx

raw
1 % \iffalse meta-comment
2
3 %
4 % Copyright (C) 2016 by Julien Cretel
5 % <jubobs.tex at gmail.com>
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either version 1.3
9 % of this license or (at your option) any later version.
10 % The latest version of this license is in
11 %
12 % http://www.latex-project.org/lppl.txt
13 %
14 % and version 1.3 or later is section of all distributions of LaTeX
15 % version 2005/12/01 or later.
16 %
17 % \fi
18 %
19 % \iffalse
20 %<package>\NeedsTeXFormat{LaTeX2e}[2011/06/27]
21 %<package>\ProvidesPackage{xcolor-solarized}
22 %<package> [2016/08/05 v0.4 xcolor definitions for Ethan Schoonover's
23 %<package> Solarized theme]
24 %
25 %<*driver>
26 \documentclass[a4paper]{ltxdoc}
27 \RecordChanges
28
29 \usepackage[T1]{fontenc}
30 \usepackage{lmodern}
31 \usepackage{xcolor-solarized}
32 \usepackage{hyperref}
33 \usepackage{url}
34 \usepackage{cleveref}
35
36 \DeclareUrlCommand\email{\urlstyle{tt}}
37
38 \newcommand*{\pkg}[1]{\textsf{#1}}
39 \newcommand*{\opt}[1]{\texttt{#1}}
40 \newcommand\solarized{\textsf{Solarized}}
41 \newcommand\solpkg{\pkg{xcolor-solarized}}
42 \newcommand\kvpkg{\pkg{kvoptions}}
43 \newcommand\xcolpkg{\pkg{xcolor}}
44
45 \begin{document}
46 \DocInput{xcolor-solarized.dtx}
47 \end{document}
48 %</driver>
49 % \fi
50 %
51 % \CheckSum{66}
52 %
53 % \CharacterTable
54 % {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
55 % 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
56 % Digits \0\1\2\3\4\5\6\7\8\9
57 % Exclamation \! Double quote \" Hash (number) \#
58 % Dollar \$ Percent \% Ampersand \&
59 % Acute accent \' Left paren \( Right paren \)
60 % Asterisk \* Plus \+ Comma \,
61 % Minus \- Point \. Solidus \/
62 % Colon \: Semicolon \; Less than \<
63 % Equals \= Greater than \> Question mark \?
64 % Commercial at \@ Left bracket \[ Backslash \\
65 % Right bracket \] Circumflex \^ Underscore \_
66 % Grave accent \` Left brace \{ Vertical bar \|
67 % Right brace \} Tilde \~}
68 %
69 % \changes{v0.1}{2014/04/24}{Initial release on GitHub}
70 % \changes{v0.2}{2015/02/14}{Major refactoring of the code}
71 % \changes{v0.3}{2015/02/17}{Submission to CTAN}
72 % \changes{v0.4}{2016/08/05}{Bugfix: remove hardcoding of default prefix}
73 %
74 % \GetFileInfo{xcolor-solarized.sty}
75 %
76 % \title{^^A
77 % The \solpkg{} package^^A
78 % \thanks{^^A
79 % This document corresponds to \solpkg~\fileversion,
80 % dated~\filedate.^^A
81 % }^^A
82 % }
83 % \author{Julien Cretel\\ \texttt{jubobs.tex at gmail.com}}
84 % \date{\filedate}
85 % \thispagestyle{empty}
86 % \maketitle
87 %
88 % \begin{abstract}
89 % Built on top of the \xcolpkg{} package, the \solpkg{} package defines the
90 % sixteen colors of Ethan Schoonover's popular color palette,
91 % \href{http://ethanschoonover.com/solarized}{\solarized}, for use in
92 % documents typeset with \LaTeX{} \& friends.
93 % \end{abstract}
94 %
95 % \tableofcontents\newpage
96 %
97 %
98 % \section{User's guide}
99 %
100 % \subsection{Installation}
101 %
102 % \subsubsection{Package dependencies}
103 %
104 % The \solpkg{} package requires relatively up-to-date versions of the
105 % \xcolpkg{} and \kvpkg{} packages, both of which ship with popular \TeX{}
106 % distributions. It loads those two packages without any options.
107 %
108 % \subsubsection{Installing \solpkg{}}
109 %
110 % Once the package is officially released on
111 % \href{http://www.ctan.org}{CTAN},
112 % you should be able to install it directly through your package manager.
113 % However, if you need to install \solpkg{} manually, you should run
114 %^^A
115 % \begin{verbatim}
116 % latex xcolor-solarized.ins\end{verbatim}
117 %^^A
118 % and copy the file called |xcolor-solarized.sty| to a path
119 % where \LaTeX{} (or your preferred typesetting engine) can find it.
120 % To generate the documentation, run
121 %^^A
122 % \begin{verbatim}
123 % pdflatex xcolor-solarized.dtx\end{verbatim}
124 %^^A%
125 % twice.
126 %
127 % \subsection{Usage}
128 %
129 % \subsubsection{Loading \texorpdfstring{\solpkg{}}{xcolor-solarized}}
130 %
131 % Simply write
132 %^^A
133 % \begin{verbatim}
134 % \usepackage{xcolor-solarized}\end{verbatim}
135 %^^A
136 % somewhere in your preamble.
137 %
138 % You may want to load the \xcolpkg{} and \kvpkg{} packages with some
139 % options; in that case, make sure those options are passed to those two
140 % packages \emph{before} loading the \solpkg{} package.
141 %
142 % \subsubsection{Package option}
143 %
144 % The \solpkg{} currently offers only one option:
145 %^^A
146 % \begin{description}
147 % \item[\opt{prefix}|=|\meta{prefix}]\leavevmode
148 %
149 % Defines the sixteen \solarized{} colors with prefix \meta{prefix},
150 % for namespacing purposes; the default prefix is ``|solarized-|''.
151 %
152 % \end{description}
153 %^^A
154 % What is the point of this option?
155 % Well, the \solarized{} colors must be namespaced in one way or another,
156 % because many of their official names, such ``red'', ``green'', etc.\ would
157 % conflict with colors defined by the \xcolpkg{} package.
158 %
159 % For convenience, you may want to use a custom prefix, shorter, perhaps, than
160 % the default one. The \opt{prefix} option allows you to do just that.
161 % For instance, if you want to use the prefix ``|sol|'', you should load the
162 % package like so:
163 %^^A
164 % \begin{verbatim}
165 % \usepackage[prefix=sol]{xcolor-solarized}\end{verbatim}
166 %^^A
167 %
168 % \subsubsection{Using the \solarized{} colors in your document}
169 %
170 % \begin{figure}
171 % \solarizedPalette
172 % \caption{The sixteen colors of Ethan Schoonover's \solarized{} palette}
173 % \label{palette}
174 % \end{figure}
175 %
176 % Loading the \solpkg{} package defines those colors at the global scope of
177 % your document, using the \xcolpkg{} package; you should refer to the
178 % documentation of the latter for more details about how to use colors in
179 % your documents.
180 %
181 % The sixteen colors of the Ethan Schoonover's \solarized{} palette are shown
182 % on \cref{palette}; for more details, see the
183 % \href{http://ethanschoonover.com/solarized}{official \solarized{} website}.
184 % The name under which \solpkg{} defines each \solarized{} color has the form
185 % \meta{prefix}\meta{name}, where
186 %^^A
187 % \begin{itemize}
188 % \item \meta{prefix} corresponds to the value of the prefix set via the
189 % package option \opt{prefix}, and
190 % \item \meta{name} is the official name of the color (see \cref{palette}).
191 % \end{itemize}
192 %^^A
193 % For example, by default (if you don't set a custom prefix),
194 % the red \solarized{} color will be available in your document
195 % under the name ``|solarized-red|''.
196 %
197 % The \solpkg{} package also defines one convenient user-level command:
198 %^^A
199 % \begin{description}
200 % \item[\cmd{\solarizedPalette}]\leavevmode
201 %
202 % Prints the sixteen colors of the palette,
203 % along with their official names
204 % \end{description}
205 %^^A
206 % This command was used to produce \cref{palette}.
207 % Use it as a tool for consulting the \solarized{} palette within your
208 % documents during the writing phase, without having to refer to some
209 % external resource (e.g.\ the
210 % \href{http://ethanschoonover.com/solarized}{official \solarized{} website}).
211 %
212 % \subsection{Bug reports and feature suggestions}
213 %
214 % The development version of \solpkg{} is currently hosted on GitHub at
215 % \href{https://github.com/Jubobs/xcolor-solarized}
216 % {Jubobs/xcolor-solarized}.
217 % If you find an issue in \solpkg{} that this manual does not mention,
218 % if you would like to see a feature implemented in the package,
219 % or if you can think of ways in which the \solpkg{} documentation could be
220 % improved, please open a ticket in the GitHub repository's issue tracker;
221 % alternatively, you can send me an email at
222 % \email{[email protected]}
223 %
224 % \subsection{Acknowledgments}
225 %
226 % Thanks to Uwe Kern, author of the \xcolpkg{} package, Heiko Oberdiek, author
227 % of the \kvpkg{} package, and Ethan Schoonover, originator of the \solarized{}
228 % color palette.
229 %
230 % \StopEventually{}
231 %
232 %
233 % \section{Implementation}
234 %
235 % Be aware that, for ``namespacing'', the \solpkg{} package uses the
236 % prefix ``|solarized|'' (followed by an |@| character) throughout.
237 %
238 % \subsection{Required packages}
239 %
240 % \solpkg{} requires the following two packages:
241 % \begin{macrocode}
242 \RequirePackage{xcolor}[2007/01/21]
243 \RequirePackage{kvoptions}[2011/06/30]
244 % \end{macrocode}
245 %
246 % \subsection{Package options}
247 %
248 % First, we set up \kvpkg{}.
249 % \begin{macrocode}
250 \SetupKeyvalOptions{
251 family=solarized,
252 prefix=solarized@
253 }
254 % \end{macrocode}
255 % Then, we declare the \opt{prefix} key-value option, with default value
256 % ``|solarized-|'', and we throw an error if any other option is passed to the
257 % \solpkg{} package.
258 % \begin{macrocode}
259 \DeclareStringOption[solarized-]{prefix}
260 \DeclareDefaultOption{%
261 \OptionNotUsed
262 \PackageError{xcolor-solarized}{Unknown `\CurrentOption' option}
263 }
264 \ProcessKeyvalOptions*
265 % \end{macrocode}
266 %
267 % \subsection{Colour definitions}
268 %
269 % \begin{macro}{\solarized@definecolor}
270 % Here is a convenient internal macro for defining colors with a custom
271 % prefix.
272 % \begin{macrocode}
273 \newcommand\solarized@definecolor[2]
274 {\expandafter\definecolor\expandafter{\solarized@prefix #1}{RGB}{#2}}
275 % \end{macrocode}
276 % \end{macro}
277 % We now define the sixteen \solarized{} colors.
278 % \begin{macrocode}
279 \solarized@definecolor{base03} {000, 043, 054}
280 \solarized@definecolor{base02} {007, 054, 066}
281 \solarized@definecolor{base01} {088, 110, 117}
282 \solarized@definecolor{base00} {101, 123, 131}
283 \solarized@definecolor{base0} {131, 148, 150}
284 \solarized@definecolor{base1} {147, 161, 161}
285 \solarized@definecolor{base2} {238, 232, 213}
286 \solarized@definecolor{base3} {253, 246, 227}
287 \solarized@definecolor{yellow} {181, 137, 000}
288 \solarized@definecolor{orange} {203, 075, 022}
289 \solarized@definecolor{red} {220, 050, 047}
290 \solarized@definecolor{magenta}{211, 054, 130}
291 \solarized@definecolor{violet} {108, 113, 196}
292 \solarized@definecolor{blue} {038, 139, 210}
293 \solarized@definecolor{cyan} {042, 161, 152}
294 \solarized@definecolor{green} {133, 153, 000}
295 % \end{macrocode}
296 %
297 % \subsection{User-level macro}
298 %
299 % \begin{macro}{\solarizedPalette}
300 % Finally, here is a user-level macro for printing the palette in a document.
301 % It takes one optional argument, which corresponds to
302 % both the length of the of the colored squares' sides
303 % and the vertical space between the two rows of squares (|3em|, by default).
304 % \begin{macrocode}
305 \newcommand\solarizedPalette[1][3em]{%
306 \newcommand\solarized@square{\rule{#1}{#1}}
307 \newcommand\solarized@showcolor[1]{%
308 \textcolor{\solarized@prefix ##1}{\solarized@square}%
309 }
310 \noindent
311 \begin{tabular}{cccc cccc}
312 \solarized@showcolor{base03} &
313 \solarized@showcolor{base02} &
314 \solarized@showcolor{base01} &
315 \solarized@showcolor{base00} &
316 \solarized@showcolor{base0} &
317 \solarized@showcolor{base1} &
318 \solarized@showcolor{base2} &
319 \solarized@showcolor{base3} \\
320 base03 & base02 & base01 & base00 &
321 base0 & base1 & base2 & base3 \\[#1]
322 \solarized@showcolor{yellow} &
323 \solarized@showcolor{orange} &
324 \solarized@showcolor{red} &
325 \solarized@showcolor{magenta}&
326 \solarized@showcolor{violet} &
327 \solarized@showcolor{blue} &
328 \solarized@showcolor{cyan} &
329 \solarized@showcolor{green} \\
330 yellow & orange & red & magenta &
331 violet & blue & cyan & green
332 \end{tabular}
333 }
334 % \end{macrocode}
335 % \end{macro}
336 %
337 % \Finale
338 \endinput