diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-05-22 01:22:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-05-22 01:22:00 +0200 |
commit | 3ecd4ddc188bb441690ea80cef39a06a875c9701 (patch) | |
tree | 4baa10dc663d18380857843629be0ab7b49d11c0 /tex/context/base/colo-ini.lua | |
parent | 2895f6edd9f6692d7941a84e30ca06254338dfa8 (diff) | |
download | context-3ecd4ddc188bb441690ea80cef39a06a875c9701.tar.gz |
beta 2012.05.22 01:22
Diffstat (limited to 'tex/context/base/colo-ini.lua')
-rw-r--r-- | tex/context/base/colo-ini.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index 08f1a303f..747e2116f 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -835,3 +835,45 @@ commands.startcolorset = colors.pushset commands.stopcolorset = colors.popset commands.usecolors = colors.usecolors + +-- bonus + +function commands.pgfxcolorspec(ca) -- {}{}{colorspace}{list} + -- local cv = attributes.colors.values[ca] + local cv = colorvalues[ca] + if cv then + local model = cv[1] + if model == 2 then + context("{gray}{%1.3f}",cv[2]) + elseif model == 3 then + context("{rgb}{%1.3f,%1.3f,%1.3f}",cv[3],cv[4],cv[5]) + elseif model == 4 then + context("{cmyk}{%1.3f,%1.3f,%1.3f,%1.3f}",cv[6],cv[7],cv[8],cv[9]) + else + context("{gray}{%1.3f}",cv[2]) + end + else + context("{gray}{0}") + end +end + +-- function commands.pgfregistercolor(name,attribute) +-- local cv = colorvalues[ca] +-- context.pushcatcodes('prt') +-- if cv then +-- local model = forcedmodel(cv[1]) +-- if model == 2 then +-- context["pgfutil@definecolor"]("{%s}{gray}{%1.3f}",name,cv[2]) +-- elseif model == 3 then +-- context["pgfutil@definecolor"]("{%s}{rgb}{%1.3f,%1.3f,%1.3f}",name,cv[3],cv[4],cv[5]) +-- elseif model == 4 then +-- context["pgfutil@definecolor"]("{%s}{cmyk}{%1.3f,%1.3f,%1.3f,%1.3f}",name,cv[6],cv[7],cv[8],cv[9]) +-- else +-- context["pgfutil@definecolor"]("{%s}{gray}{0}",name) +-- end +-- else +-- context["pgfutil@definecolor"]("{%s}{gray}{0}",name) +-- end +-- context.popcatcodes() +-- end + |