%D \module %D [ file=colo-ext, % mostof thsi code used to be in colo-ini.tex %D version=1997.04.01, %D title=\CONTEXT\ Color Macros, %D subtitle=Extras, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. \writestatus{loading}{ConTeXt Color Macros / Extras} \unprotect %D \macros %D {negatecolorcomponent, negativecolorbox} %D %D Sometimes, especially when we deal with typesetting %D devices, we want to reverse the color scheme. Instead of %D recalculating all those colors, we use a quick and dirty %D approach: %D %D \starttyping %D \negativecolorbox0 %D \stoptyping %D %D will negate the colors in box zero. \def\negatecolorbox#1% {\setbox#1\hbox {\startnegativeproperty % might change \startcolor[white]\vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1\stopcolor \hskip-\wd#1% \box#1% \stopnegativeproperty}} %D There are in principle two ways to handle overprint: bound to colors %D or independent. For the moment we only support independent overprint %D handling. Here we deal with a per-document setting. \unexpanded\def\startcolorintent[#1]% {\pushattribute\colorintentattribute \dotriggercolorintent{#1}} \unexpanded\def\stopcolorintent {\popattribute\colorintentattribute} \unexpanded\def\startoverprint{\startcolorintent[\v!overprint]} \unexpanded\def\stopoverprint {\stopcolorintent} \unexpanded\def\startknockout {\startcolorintent[\v!knockout ]} \unexpanded\def\stopknockout {\stopcolorintent} \let\starttextcolorintent\relax \let\stoptextcolorintent \relax \setupcolors [\c!overprint=\v!no] \appendtoks \dosettextcolorintent \to \everysetupcolors \def\dosettextcolorintent {\doifnot\@@clintent\v!none {\xdef\starttextcolorintent{\noexpand\dotriggercolorintent{\@@clintent}}% \glet\dosettextcolorintent\relax \dotriggercolorintent\@@clintent}} \appendtoks \starttextcolorintent \to \everystarttextproperties \appendtoks \stoptextcolorintent \to \everystoptextproperties \setupcolors[\c!intent=\v!none] % A goodie that replaces the startMPcolor hackery % % \definecolor[red-t] [r=1,t=0.5,a=1] % \definecolor[green-t][g=1,t=0.5,a=1] % \defineintermediatecolor[mycolora][0.5,red,green] % \defineintermediatecolor[mycolorb][0.5,red-t,green-t] % \starttext % test {\mycolora OEPS} test % test {\mycolorb OEPS} test % \stoptext \unexpanded\def\defineintermediatecolor {\dotripleempty\dodefineintermediatecolor} \def\dodefineintermediatecolor[#1][#2][#3]% \dotripleempty adds {} inside [] {\dododefineintermediatecolor[#1][#2][#3]} \def\dododefineintermediatecolor[#1][#2,#3,#4][#5]% {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi \ctxlua{colors.defineintermediatecolor("#1","#2", \thecolorattribute{#3},\thecolorattribute{#4}, \thetransparencyattribute{#3},\thetransparencyattribute{#4}, "#5",false,\iffreezecolors true\else false\fi)}% not global \dodefinecolorcommand\setvalue{#1}} \protect \endinput