summaryrefslogtreecommitdiff
path: root/macros/generic/diagrams/xypic/texinputs/xycolor.tex
blob: d4a6574218d814a94d3696e7989bf0b0e4f2a572 (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
%% xycolor.tex from $Id: xycolor.doc,v 3.11 2011/03/14 20:14:00 krisrose Exp $
%%
%% Xy-pic ``Colour extension'' option.
%% Copyright (c) 1993-1996 Ross Moore <ross.moore@mq.edu.au>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-2011 Kristoffer H. Rose <krisrose@tug.org>
%%
%% The Xy-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The Xy-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, see http://www.gnu.org/licenses/.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{color}{Colour extension}{\stripRCS$Revision: 3.11 $}%
 {Ross Moore}{ross.moore@mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\xydef@\xycolorwarning@@{\xycolormessage@
 \gdef\xycolorwarning@{\xycolormessage@
 \xywarning@{...no further colour warnings will be given.}%
 \global\let\xycolorwarning@=\relax }}
\xylet@\xycolorwarning@=\xycolorwarning@@
\xydef@\xycolormessage@{%
 \xywarning@{Current driver does not support colour.}}%
\xydef@\xyNoColor@#1{}
\xylet@\xycolor@@=\xyNoColor@
\xydef@\xyNoColor@@#1#2{\xycolorwarning@}
\xydef@\xycolor@{\xycolor@@}
\xylet@\xylocalColor@=\xyNoColor@@
\xydef@\UnloadColor@{%
 \let\xylocalColor@=\xyNoColor@@
 \let\xycolor@@=\xyNoColor@
 \let\xycolorwarning@=\xycolorwarning@@ }
\xylet@\UnloadColor@@=\UnloadColor@
\xyaddunsupport{color}{\UnloadColor@@\relax}
\ifx\current@color\undefined \xydef@\xybasecolor@{}%
\else \def\xybasecolor@{\current@color}\fi
\xydef@\xystackcolor@{\bgroup \DN@##1##2{\egroup}%
 \ifInvisible@\else\ifHidden@\else\DNii@{\no@@}\ifx\nextii@\Connect@@ 
 \else\DN@{\xystackcolor@i}\fi\fi\fi \next@ } 
\xydef@\xystackcolor@i#1#2{\checkXyStyle@ 
 \DN@{#2}\ifx\next@\empty
 \def\tmp@##1{\DN@{\xycolor@push{#1}##1\xycolor@pop}}%
 \else\def\tmp@##1{\DN@{\xycolor@push{#2 #1}##1\xycolor@pop}}\fi
 \toks@={\egroup \let\xy@style@=\relax \def\Drop@@}%
 \expandafter\tmp@\expandafter{\Drop@@}%
 \expandafter\addtotoks@\expandafter{\expandafter{\next@}\def\Connect@@}%
 \expandafter\tmp@\expandafter{\Connect@@}%
 \expandafter\addtotoks@\expandafter{\expandafter{\next@}}%
 \the\toks@ }%
\xydef@\xycolor@push@@#1{\special{color push #1}}
\xydef@\xycolor@pop{\special{color pop}}
\xylet@\xycolor@push=\xycolor@push@@
\xydef@\newxycolor#1#2{\newxyColor{#1}{}{}{#2}{}}
\xydef@\newxyColor#1#2#3#4{\newxycolor@{#1}{#2}{#3}{#4}{}}
\xydef@\newxycolor@#1#2#3#4#5{%
 \expandafter\let\expandafter\next@\csname shape [#1]\endcsname
 \ifx\next@\relax
 \DN@{#4}\ifx\next@\empty
 \DN@{#2}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalColor@{}{#3}\xycolor@{#3}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#2 #3}}}%
 \fi
 \else\DN@{#2#3}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalColor@{#4}{}\xycolor@{#4}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#4}}}%
 \fi \fi 
 \else \def\tmp@{\relax}\DNii@{#5}%
 \ifx\nextii@\tmp@
 \DN@{#4}\ifx\next@\empty
 \DN@{#2}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalColor@{}{#3}\xycolor@{#3}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#2 #3}}}%
 \fi
 \else
 \DN@{#2#3}\ifx\next@\empty
 \DN@{\newxystyle{#1}{\xylocalColor@{#4}{}\xycolor@{#4}}}%
 \else
 \DN@{\newxystyle{#1}{\xylocalColor@{#2}{#3}\xycolor@{#4}}}%
 \fi \fi 
 \else\DN@{}\fi\fi \next@\relax}
\xydef@\xystandardcolors@{%
 \newxycolor@{black}{0. 0. 0.}{rgb}{}\relax
 \newxycolor@{white}{1. 1. 1.}{rgb}{}\relax
 \newxycolor@{gray}{.5}{gray}{}\relax
 \newxycolor@{grey}{.5}{gray}{}\relax
 \newxycolor@{red}{1. 0. 0.}{rgb}{}\relax
 \newxycolor@{green}{0. 1. 0.}{rgb}{}\relax
 \newxycolor@{blue}{0. 0. 1.}{rgb}{}\relax
 \newxycolor@{cyan}{0. 1. 1.}{rgb}{}\relax
 \newxycolor@{magenta}{1. 0. 1.}{rgb}{}\relax
 \newxycolor@{yellow}{1. 1. 0.}{rgb}{}\relax
 \xyuncatcodes }
\xydef@\UseCrayolaColors{\xyrequire{crayon}\xyuncatcodes}%
\xydef@\xyBEcolorcheck@{\ifx\xycolor@@\xyNoColor@\else
 \xywarning@{PostScript colour support should be OK.}\fi }%
\xywithoption{ps}{%
 \xyinputorelse@{xyps-c}{\xyerror@{Could not load xyps-c}{}}}%
 \xycatcodes
\xyendinput