ColorAll
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Game | non-mud specific |
By | ThePhoenix in conjunction with Keneanung |
Download | none |
Dependencies | Mudlet 4.17 |
Description
It works to highlight all of 'word' on a line.
Usage
function colorAll(word, color, back, italic, under,bold, noCase)
--word is the string to search for
--color is fg color, either in name or "r,g,b" string
--back is bg color, either in name of "r,g,b" string
--italic is boolean italics
--under is boolean underlining
--bold is boolean bold format
--noCase is boolean. if true, matches word on a no-case pattern
if noCase then word = word:genNocasePattern() end
local startpos = 0
local endpos = 0
while true do
startpos, endpos = string.find(getCurrentLine(), "%f[%w]"..word.."%f[%W]", endpos)
if not startpos then break end
selectSection(startpos-1, endpos-startpos+1)
if color then
if color_table[color] then
fg(color)
else
local c = color:split(",")
setFgColor(c[1],c[2],c[3])
end
end
if back then
if color_table[back] then
bg(back)
else
local b = back:split(",")
setBgColor(b[1],b[2],b[3])
end
end
if under then
setUnderline(true)
end
if italic then
setItalics(true)
end
if bold then
setBold(true)
end
end
end