summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mlib-svg.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-03-30 14:22:51 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-03-30 14:22:51 +0200
commit8dcafbcc0fbdde27cf480584450516602daacd42 (patch)
treee86361c3ded314bfa4be74fba251e187b6fdfe67 /tex/context/base/mkiv/mlib-svg.lua
parentdd8e1bab358884db6ba3f2373f515fbcc991e5ee (diff)
downloadcontext-8dcafbcc0fbdde27cf480584450516602daacd42.tar.gz
2020-03-30 13:35:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-svg.lua')
-rw-r--r--tex/context/base/mkiv/mlib-svg.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/mlib-svg.lua b/tex/context/base/mkiv/mlib-svg.lua
index 9fd1da44e..2a1b476ae 100644
--- a/tex/context/base/mkiv/mlib-svg.lua
+++ b/tex/context/base/mkiv/mlib-svg.lua
@@ -520,13 +520,18 @@ local colorcomponents, withcolor, thecolor, usedcolors do
local p_splitcolor =
P("#") * C(p_hexdigit*p_hexdigit)^1 / function(r,g,b)
- return "rgb",
- tonumber(r or 0, 16) / 255 or 0,
- tonumber(g or 0, 16) / 255 or 0,
- tonumber(b or 0, 16) / 255 or 0
+ if not r then
+ return "gray", 0
+ elseif not (g and b) then
+ return "gray", tonumber(r or "0", 16) / 255 or 0
+ else
+ return "rgb",
+ tonumber(r or "0", 16) / 255 or 0,
+ tonumber(g or "0", 16) / 255 or 0,
+ tonumber(b or "0", 16) / 255 or 0
+ end
end
- +
- P("rgb") * p_a
+ + P("rgb") * p_a
* p_left * (p_fraction + p_separator)^-3 * (p_absolute + p_separator)^0 * p_right / function(r,g,b,a)
return "rgb", r or 0, g or 0, b or 0, a or false
end