Debian Codegraph @

texmf-dist/tex/latex/graphics/color.sty

raw
1 %%
2 %% This is file `color.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% color.dtx (with options: `package')
8 %%
9 %% The source is maintained by the LaTeX Project team and bug
10 %% reports for it can be opened at https://latex-project.org/bugs/
11 %% (but please observe conditions on bug reports sent to that address!)
12 %%
13 %%
14 %% color.dtx Copyright (C) 1994--1999 David Carlisle
15 %% Copyright (C) 2005-2025 LaTeX Project
16 %% The LaTeX Project and any individual authors listed elsewhere
17 %% in this file.
18 %%
19 %% This file is part of the Standard LaTeX `Graphics Bundle'.
20 %% It may be distributed under the terms of the LaTeX Project Public
21 %% License, as described in lppl.txt in the base LaTeX distribution.
22 %% Either version 1.3c or, at your option, any later version.
23 %%
24 %% This file has the LPPL maintenance status "maintained".
25 %%
26 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
27 \ProvidesPackage{color}
28 [2025/01/14 v1.3e Standard LaTeX Color (DPC)]
29 \edef\Gin@codes{%
30 \catcode`\noexpand\^^A\the\catcode`\^^A\relax
31 \catcode`\noexpand\"\the\catcode`\"\relax
32 \catcode`\noexpand\*\the\catcode`\*\relax
33 \catcode`\noexpand\!\the\catcode`\!\relax
34 \catcode`\noexpand\:\the\catcode`\:\relax}
35 \catcode`\^^A=\catcode`\%
36 \catcode`\"=12
37 \catcode`\*=11
38 \catcode`\!=12
39 \catcode`\:=12
40 \providecommand\Gin@driver{}
41 \def\c@lor@error#1{%
42 \@latex@error{Undefined color #1}\@ehd}
43 \DeclareOption{monochrome}{%
44 \def\c@lor@error#1{\PackageInfo{color}{Undefined color #1}}%
45 \AtEndOfPackage{%
46 \colors@false
47 \def\set@color{%
48 \c@lor@special\m@ne
49 {color push \current@color}\aftergroup\reset@color}%
50 \def\reset@color{\c@lor@special\m@ne{color pop}}%
51 \def\set@page@color{%
52 \c@lor@special\m@ne{background \current@color}}%
53 \def\define@color#1#2{%
54 \c@lor@special\m@ne{define #1 #2}}}}
55 \DeclareOption{debugshow}{\catcode`\^^A=9 \let\GDebug\typeout}
56 \newif\ifGin@setpagesize\Gin@setpagesizetrue
57 \DeclareOption{setpagesize}{\Gin@setpagesizetrue}
58 \DeclareOption{nosetpagesize}{\Gin@setpagesizefalse}
59 \DeclareOption{dvips}{\def\Gin@driver{dvips.def}%
60 \def\c@lor@namefile{dvipsnam.def}}
61 \DeclareOption{xdvi}{\ExecuteOptions{dvips,monochrome}}
62 \DeclareOption{dvipdf}{\def\Gin@driver{dvipdf.def}}
63 \DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfmx.def}}
64 \DeclareOption{dvipdfmx}{\def\Gin@driver{dvipdfmx.def}}
65 \DeclareOption{pdftex}{\def\Gin@driver{pdftex.def}}
66 \DeclareOption{luatex}{\def\Gin@driver{luatex.def}}
67 \DeclareOption{dvisvgm}{\def\Gin@driver{dvisvgm.def}}
68 \DeclareOption{xetex}{\def\Gin@driver{xetex.def}}
69 \DeclareOption{dvipsone}{\def\Gin@driver{dvipsone.def}}
70 \DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}}
71 \DeclareOption{emtex}{\def\Gin@driver{emtex.def}}
72 \DeclareOption{dviwin}{\def\Gin@driver{dviwin.def}}
73 \DeclareOption{oztex}{\ExecuteOptions{dvips}}
74 \DeclareOption{textures}{\def\Gin@driver{textures.def}}
75 \DeclareOption{pctexps}{\def\Gin@driver{pctexps.def}}
76 \DeclareOption{pctexwin}{\def\Gin@driver{pctexwin.def}}
77 \DeclareOption{pctexhp}{\def\Gin@driver{pctexhp.def}}
78 \DeclareOption{pctex32}{\def\Gin@driver{pctex32.def}}
79 \DeclareOption{truetex}{\def\Gin@driver{truetex.def}}
80 \DeclareOption{tcidvi}{\def\Gin@driver{tcidvi.def}}
81 \DeclareOption{vtex}{\def\Gin@driver{vtex.def}}
82 \DeclareOption{dvipsnames}{\def\c@lor@namefile{dvipsnam.def}}
83 \DeclareOption{nodvipsnames}{\let\c@lor@namefile\relax}
84 \let\c@lor@usename\@gobble
85 \DeclareOption{usenames}{%
86 \def\c@lor@usename#1{%
87 \expandafter\color@named\csname\@backslashchar color@#1\endcsname{#1}}}
88 \DeclareRobustCommand\color{%
89 \@ifnextchar[\@undeclaredcolor\@declaredcolor}
90 \def\@undeclaredcolor[#1]#2{%
91 \@ifundefined{color@#1}%
92 {\c@lor@error{model `#1'}}%
93 {\csname color@#1\endcsname\current@color{#2}%
94 \set@color}%
95 \ignorespaces}
96 \def\@declaredcolor#1{%
97 \@ifundefined{\@backslashchar color@#1}%
98 {\c@lor@error{`#1'}}%
99 {\expandafter\let\expandafter\current@color
100 \csname\@backslashchar color@#1\endcsname
101 \set@color}%
102 \ignorespaces}
103 \protected\def\textcolor#1#{\@textcolor{#1}}
104 \def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
105 \protected\def\pagecolor{%
106 \begingroup
107 \let\ignorespaces\endgroup
108 \let\set@color\set@page@color
109 \color}
110 \protected\def\nopagecolor{%
111 \@ifundefined{no@page@color}{%
112 \PackageInfo{color}{\@backslashchar nopagecolor\space is not supported}%
113 }{%
114 \no@page@color
115 }%
116 }
117 \protected\def\definecolor#1#2#3{%
118 \@ifundefined{color@#2}%
119 {\c@lor@error{model `#2'}}%
120 {\@ifundefined{\@backslashchar color@#1}{}%
121 {\PackageInfo{color}{Redefining color #1}}%
122 \csname color@#2\expandafter\endcsname
123 \csname\@backslashchar color@#1\endcsname{#3}}}
124 \protected\def\DefineNamedColor#1#2#3#4{%
125 \@ifundefined{define@color@#1}%
126 {\c@lor@error{model `#1'}}%
127 {\@ifundefined{color@#3}%
128 {\c@lor@error{model `#3'}}%
129 {\@ifundefined{col@#2}{}%
130 {\PackageInfo{color}{Redefining color #2 in named color model}}%
131 \csname color@#3\endcsname\@tempa{#4}%
132 \csname define@color@#1\endcsname{#2}\@tempa
133 \c@lor@usename{#2}}}}
134 \@onlypreamble\DefineNamedColor
135 \newif\ifcolors@
136 \colors@true
137 \def\c@lor@special#1#2{%
138 \edef\@tempa{\write#1{#2}}\@tempa}
139 \InputIfFileExists{color.cfg}{}{}
140 \ProcessOptions
141 \if!\Gin@driver!
142 \PackageError{color}
143 {No driver specified}
144 {You should make a default driver option in a file \MessageBreak
145 color.cfg\MessageBreak
146 eg: \protect\ExecuteOptions{dvips}%
147 }
148 \else
149 \PackageInfo{color}{Driver file: \Gin@driver}
150 \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{}
151 \fi
152 \@ifundefined{c@lor@namefile}{}{\input{\c@lor@namefile}}
153 \protected\def\normalcolor{\let\current@color\default@color\set@color}
154 \AtBeginDocument{\let\default@color\current@color}
155 \def\color@block#1#2#3{%
156 {\set@color\rlap{\ifcolors@\vrule\@width#1\@height#2\@depth#3\fi}}}
157 \protected\def\colorbox#1#{\color@box{#1}}
158 \def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
159 \protected\def\fcolorbox#1#{\color@fbox{#1}}
160 \def\color@fbox#1#2#3{%
161 \color@b@x{\fboxsep\z@\color#1{#2}\fbox}{\color#1{#3}}}
162
163 \long\def\color@b@x#1#2#3{%
164 \leavevmode
165 \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}%
166 \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
167 \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
168 {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}%
169 \box\z@}}}
170 \input{mathcolor.ltx}
171 \def\color@setgroup{\begingroup\set@color}
172 \let\color@begingroup\begingroup
173 \def\color@endgroup{\endgraf\@endpefalse\endgroup}
174 \def\color@hbox{\hbox\bgroup\color@begingroup}
175 \def\color@vbox{\vbox\bgroup\color@begingroup}
176 \def\color@endbox{\color@endgroup\egroup}
177 \ifx\color@gray\@undefined
178 \ifx\color@rgb\@undefined
179 \else
180 \definecolor{black}{rgb}{0,0,0}
181 \definecolor{white}{rgb}{1,1,1}
182 \fi
183 \else
184 \definecolor{black}{gray}{0}
185 \definecolor{white}{gray}{1}
186 \fi
187 \ifx\color@rgb\@undefined\else
188 \definecolor{red}{rgb}{1,0,0}
189 \definecolor{green}{rgb}{0,1,0}
190 \definecolor{blue}{rgb}{0,0,1}
191 \fi
192 \ifx\color@cmyk\@undefined\else
193 \definecolor{cyan}{cmyk}{1,0,0,0}
194 \definecolor{magenta}{cmyk}{0,1,0,0}
195 \definecolor{yellow}{cmyk}{0,0,1,0}
196 \fi
197 \Gin@codes
198 \let\Gin@codes\relax
199 \endinput
200 %%
201 %% End of file `color.sty'.