26 Oct
2008
26 Oct
'08
2:05 p.m.
This is sending me down the right paths (at least showing me the sign post ;0) - I know I'm a pain in the neck, but the attached minimal (mirroring your proposal with the "colored" snippet fixed) compiles to to "black" "test"s ... What's wrong? Thanks, Joh Hans Hagen wrote:
\starttext
\startluacode document.commands = document.commands or { } function document.commands.somehexcolor(str) local r, g, b = str:match("#(..)(..)(..)") r, g, b = tonumber(r,16) or 0, tonumber(g,16) or 0, tonumber(b,16) or 0
tex.sprint(string.format("\\colored[r=%s,g=%s,b=%s]",r/255,g/255,b/255)) end \stopluacode
\setupcolors[state=start]
\def\WhatAMess#1{\ctxlua{document.commands.somehexcolor("#1")}}
{test \WhatAMess{\letterhash FF3344} test}
\stoptext