Deze module is nog in ontwikkeling (versie 0.0) en wordt getest.
De Module:Layout is bedoeld om snel, consistent en uitgebreid een pagina op te maken.
Er is een op de module afgestemde handleiding over deze onderwijswiki beschikbaar.
localcolor={}-- This function returns an array of shades based on the r, g, b color and the number of tones.functioncolor.shades(r,g,b,tones)-- : arraylocalshades={};localstep=1/(tones+1);fori=1,tonesdolocalfactor=i*step;shades[i]=string.format("#%02X%02X%02X",r*factor,g*factor,b*factor);endreturnshades;end-- This function returns an array of tints based on the r, g, b color and the number of tones.functioncolor.tints(r,g,b,tones)-- : arraylocaltints={};localstep=1/(tones+1);fori=1,tonesdolocalfactor=i*step;tints[i]=string.format("#%02X%02X%02X",r+(255-r)*factor,g+(255-g)*factor,b+(255-b)*factor);endreturntints;end-- Only allow 6-digit hexadecimal color codesfunctioncolor.valid(hexacode)-- : boolean-- Allow a single code as well as an array of codeslocalcodes={};iftype(hexacode)~="table"andtype(hexacode)~="string"thenreturnfalse;endiftype(hexacode)=="table"thencodes=hexacode;elsecodes={hexacode};end-- All codes must be correctforindex,valueinipairs(codes)do--The code should be a stringifnottype(value)=="string"thenreturnfalse;endvalue=mw.text.trim(value);-- Skip empty valuesifvalue~=""then-- Allow codes without the # prefixifstring.sub(value,1,1)~="#"thenvalue="#"..value;end-- The string.match( hexcode, "^#(%x%x%x)$" ) check is also correct for colorcodes but not in this moduleifnotstring.match(value,"^#(%x%x%x%x%x%x)$")thenreturnfalse;endendendreturntrue;endreturncolor;