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

\long\def\color@b@x#1#2#3{%
 \leavevmode
 \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}%
 \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
 \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
 {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}%
      \box\z@}}}
\def\color@setgroup{\begingroup\set@color}
\let\color@begingroup\begingroup
\def\color@endgroup{\endgraf\endgroup}
\def\color@hbox{\hbox\bgroup\color@begingroup}
\def\color@vbox{\vbox\bgroup\color@begingroup}
\def\color@endbox{\color@endgroup\egroup}
\ifx\color@gray\@undefined
  \ifx\color@rgb\@undefined
  \else
    \definecolor{black}{rgb}{0,0,0}
    \definecolor{white}{rgb}{1,1,1}
  \fi
\else
  \definecolor{black}{gray}{0}
  \definecolor{white}{gray}{1}
\fi
\ifx\color@rgb\@undefined\else
  \definecolor{red}{rgb}{1,0,0}
  \definecolor{green}{rgb}{0,1,0}
  \definecolor{blue}{rgb}{0,0,1}
\fi
\ifx\color@cmyk\@undefined\else
  \definecolor{cyan}{cmyk}{1,0,0,0}
  \definecolor{magenta}{cmyk}{0,1,0,0}
  \definecolor{yellow}{cmyk}{0,0,1,0}
\fi
\Gin@codes
\let\Gin@codes\relax
\endinput
%%
%% End of file `color.sty'.