diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/colo-ini.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/colo-ini.lua | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/colo-ini.lua b/Master/texmf-dist/tex/context/base/colo-ini.lua index 08f1a303f05..747e2116f08 100644 --- a/Master/texmf-dist/tex/context/base/colo-ini.lua +++ b/Master/texmf-dist/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 + |