8,756
edits
(hacky solid implementation) |
(allow option to make it output old & delimited color codes) |
||
Line 107: | Line 107: | ||
-- Beta Parse -- | -- Beta Parse -- | ||
function p.shader(text, colors, type) | function p.shader(text, colors, type, rasterize) | ||
-- split the colors into a list | -- split the colors into a list | ||
local colorlist = textutil.split(colors, '-') | local colorlist = textutil.split(colors, '-') | ||
Line 115: | Line 115: | ||
-- alternation | pattern will stretch to fit word length (?) | -- alternation | pattern will stretch to fit word length (?) | ||
local type = type or 'default' | local type = type or 'default' | ||
local rasterize = rasterize or false | |||
local strtbl = strtotbl(text) | local strtbl = strtotbl(text) | ||
local finaltbl = {} | local finaltbl = {} | ||
Line 148: | Line 149: | ||
hexcolor = colorlist[ci] | hexcolor = colorlist[ci] | ||
end | end | ||
if rasterize then | |||
finaltbl[i] = "<span style=\"color: " .. luatable.parse(hexcolor) .. ";\">" .. strtbl[i].. "</span>" | |||
else | |||
finaltbl[i] = "&" .. hexcolor .. strtbl[i] | |||
end | |||
if i%interval == 0 then | if i%interval == 0 then | ||
if bordered == true then | if bordered == true then | ||
Line 163: | Line 168: | ||
local args = process_args.merge(true) | local args = process_args.merge(true) | ||
if args[1] and args[2] then -- shader template | if args[1] and args[2] then -- shader template | ||
output = applytemplate(args[1], args[2]) | output = applytemplate(args[1], args[2], (args['rasterize'] or false)) | ||
else | else | ||
output = p.shader(args['text'], args['colors'], args['type']) | output = p.shader(args['text'], args['colors'], args['type'], args['rasterize']) | ||
end | end | ||