-
Notifications
You must be signed in to change notification settings - Fork 0
/
color.sty
176 lines (175 loc) · 6.2 KB
/
color.sty
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
%%
%% This is file `color.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% color.dtx (with options: `package')
%%
%% color.dtx Copyright (C) 1994--1999 David Carlisle
%%
%% 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.0 or, at your option, any later version.
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{color}
[1999/02/16 v1.0i Standard LaTeX Color (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}
\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{pdftex}{\def\Gin@driver{pdftex.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}
\def\textcolor#1#{\@textcolor{#1}}
\def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}}
\def\pagecolor{%
\begingroup
\let\ignorespaces\endgroup
\let\set@color\set@page@color
\color}
\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}}}
\def\DefineNamedColor#1#2#3#4{%
\@ifundefined{define@color@#1}%
{\c@lor@error{model `#1'}}%
{\@ifundefined{color@#3}%
{\c@lor@error{model `#3'}}%
{\@ifundefined{c@lor@#1@#2}{}%
{\PackageInfo{color}{Redefining color #2 in named color model}}%
\csname color@#3\endcsname\@tempa{#4}%
\csname define@color@#1\endcsname{#2}\@tempa
\c@lor@usename{#2}}}}
\@onlypreamble\DefineNamedColor
\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}}
\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}}}
\def\colorbox#1#{\color@box{#1}}
\def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
\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'.