summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/attr-col.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-11-29 20:53:37 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-11-29 20:53:37 +0100
commit9bd28a3039a458b054459fe1ef80161b107b798f (patch)
treec15bf6aedc4313de999a97bf92dc63b16ca60794 /tex/context/base/mkiv/attr-col.lua
parent744095aa4676553437db0d71c281a74557a3222f (diff)
downloadcontext-9bd28a3039a458b054459fe1ef80161b107b798f.tar.gz
2018-11-29 19:54:00
Diffstat (limited to 'tex/context/base/mkiv/attr-col.lua')
-rw-r--r--tex/context/base/mkiv/attr-col.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/tex/context/base/mkiv/attr-col.lua b/tex/context/base/mkiv/attr-col.lua
index 4e5f59fb1..2d4b65181 100644
--- a/tex/context/base/mkiv/attr-col.lua
+++ b/tex/context/base/mkiv/attr-col.lua
@@ -114,12 +114,16 @@ local data = colors.data
local values = colors.values
local registered = colors.registered
+local cmykrgbmode = 0 -- only for testing, already defined colors are not affected
+
local numbers = attributes.numbers
local list = attributes.list
registerstorage("attributes/colors/values", values, "attributes.colors.values")
registerstorage("attributes/colors/registered", registered, "attributes.colors.registered")
+directives.register("colors.cmykrgbmode", function(v) cmykrgbmode = tonumber(v) or 0 end)
+
local f_colors = {
rgb = formatters["r:%s:%s:%s"],
cmyk = formatters["c:%s:%s:%s:%s"],
@@ -148,8 +152,11 @@ end
local function cmyktorgb(c,m,y,k)
if not c then
return 0, 0, 0, 1
+ elseif cmykrgbmode == 1 then
+ local d = 1.0 - k
+ return 1.0 - min(1.0,c*d+k), 1.0 - min(1.0,m*d+k), 1.0 - min(1.0,y*d+k)
else
- return 1.0 - min(1.0,c+k), 1.0 - min(1.0,m+k), 1.0 - min(1.0,y+k)
+ return 1.0 - min(1.0,c +k), 1.0 - min(1.0,m +k), 1.0 - min(1.0,y +k)
end
end