summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/colo-ini.mkiv
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-22 21:04:25 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-22 21:04:25 +0000
commita115fb4ebf3890ee3cabdf98f3f945a349860752 (patch)
treee4d25217d24f4c1b6d863007725f538169379e87 /Master/texmf-dist/tex/context/base/colo-ini.mkiv
parentd36378879c10c7378bc52d9fe7d1ce9c3677d98b (diff)
ConTeXt 2012.05.22 16:12
git-svn-id: svn://tug.org/texlive/trunk@26572 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/colo-ini.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/colo-ini.mkiv45
1 files changed, 45 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/colo-ini.mkiv b/Master/texmf-dist/tex/context/base/colo-ini.mkiv
index 164b39262ff..5721bb513bb 100644
--- a/Master/texmf-dist/tex/context/base/colo-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/colo-ini.mkiv
@@ -702,6 +702,51 @@
"#5",false,\iffreezecolors true\else false\fi)}% not global
\unexpanded\setvalue{#1}{\colo_helpers_activate{#1}}}
+%D Here is a more efficient helper for pgf:
+%D
+%D \starttying
+%D \startluacode
+%D function commands.pgfxcolorspec(ca) -- {}{}{colorspace}{list}
+%D local cv = attributes.colors.values[ca]
+%D if cv then
+%D local model = cv[1]
+%D if model == 2 then
+%D context("{}{}{gray}{%1.3f}",cv[2])
+%D elseif model == 3 then
+%D context("{}{}{rgb}{%1.3f,%1.3f,%1.3f}",cv[3],cv[4],cv[5])
+%D elseif model == 4 then
+%D context("{}{}{cmyk}{%1.3f,%1.3f,%1.3f,%1.3f}",cv[6],cv[7],cv[8],cv[9])
+%D else
+%D context("{}{}{gray}{%1.3f}",cv[2])
+%D end
+%D else
+%D context("{}{}{gray}{0}")
+%D end
+%D end
+%D \stopluacode
+%D
+%D \def\pgfutil@registercolor#1%
+%D {\setevalue{\string\color@#1}{\noexpand\xcolor@\ctxcommand{pgfxcolorspec(\thecolorattribute{#1})}}}
+%D
+%D \definecolor [darkblue] [r=0,g=0,b=0.5]
+%D
+%D \starttikzpicture
+%D \fill [blue] (0,0) circle(1);
+%D \fill [darkblue] (0,0) circle(1);
+%D \stoptikzpicture
+%D \stoptyping
+%D
+%D \stopmode
+
+\def\pgf@context@registercolor#1% bonus macro
+ {\setevalue{\string\color@#1}{\noexpand\xcolor@{}{}\ctxcommand{pgfxcolorspec(\thecolorattribute{#1})}}}
+
+%D \starttyping
+%D \ifdefined\pgf@context@registercolor
+%D \let\pgfutil@registercolor\pgf@context@registercolor
+%D \fi
+%D \stoptyping
+
%D \macros
%D {doifcolorelse, doifcolor}
%D