%% xycolor.tex from $Id: xycolor.doc,v 3.3 1996/12/19 03:50:08 ross Exp $
%%
%% Xy-pic ``Colour extension'' option.
%% Copyright (c) 1993-1996 Ross Moore <ross@mpce.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-1996 Kristoffer H. Rose <krisrose@brics.dk>
%%
%% 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, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{color}{Colour extension}{\stripRCS$Revision: 3.3 $}%
 {Ross Moore}{ross@mpce.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
