Is it possible to get the metapost construct »withcolor« to work with text or do I have to take a different approach?
I understood from a much earlier discussion with Hans that "withcolor" will not be made to work with text, whose color therefore has to be set with ConTeXt constructs. Thanks for the information. But how to do this? How can I set up the randomness in ConTeXt? I browsed a bit through the sources and found a lua snipped producing random integers. So here's my first attempt.
% only Integers, so not much variation in color :-( \def\r{\ctxlua{commands.getrandomcounta(0,1)}} % Defining the colour at this point makes it kind of static again \definecolor[my][r=\r,g=\r,b=\r] \starttext \startuseMPgraphic {1} % The colour is all the same, but different in each run for i=0 upto 5: label(textext("\color[my]{Test}"), (i*1cm,-2cm)); endfor; % Does not work, results in compile error % for i=0 upto 5: % label(textext("\definecolor[my][r=\r,g=\r,b=\r]\color[my]{Test}"), % (i*1cm,-3cm)); % endfor; \stopuseMPgraphic \useMPgraphic {1} \stoptext Maybe this code is an improvable step in the right direction, maybe it's rubbish. Necessary improvements need to be: i) need of floating point random numbers ii) random colours per call and not per ConTeXt run iii) the use is quite verbose, so need to put it in a macro Any hints appreciated. Marco