lua showColors()
Print out all named colors
Re: Print out all named colors
Try this, it discards all colours including capitals (because they're duplicates of colours containing _) and prints them in nice columns. Change the if wrap==5 to some other value to change how many columns on the page.
Oh, and please, if you can make this shorter and nicer, post a reply.
Edit: I removed about a third of the lines.
Oh, and please, if you can make this shorter and nicer, post a reply.
Edit: I removed about a third of the lines.
Code: Select all
wrap=0
for i,v in pairs(color_table) do
if string.find(i,'%u') == nil then
fg(i)
echo (i .. string.rep(" ",22-string.len(i)))
resetFormat()
if wrap == 5 then
wrap = 0
echo("\n")
else
wrap = wrap + 1
end
end
end
Re: Print out all named colors
I've actually submitted a patch to get rid of the duplicate colors, its not in yet. But that is nicer.
Re: Print out all named colors
Thanks, I was actually looking for this list.
Re: Print out all named colors
while having the script is nice and all, I thought I'd post up a new, formatted, duplicate removed color card in image format. Because it can be nice to have something to stare out without having the mud client open while making your color choices. So here it is. Again, if you click on it you'll get a non-squished version.
I think I'm going to work on one that uses the bg color to show the color, and keeps the txt in black. Make it easier to see the actual colors.
Edited: I think this has the snapshot the way I want it. finally.
I think I'm going to work on one that uses the bg color to show the color, and keeps the txt in black. Make it easier to see the actual colors.
Edited: I think this has the snapshot the way I want it. finally.
Re: Print out all named colors
I already have a function for this going into the next version. It's showColors(number_of_columns), it defaults to 3 columns.
Re: Print out all named colors
You rock, I won't reinvent the wheel then =)
can't wait for the new version, now. heh
Is it in the luaglobal in git head? <ponders compiling>
ETA: did you hardcode all of that, or check some values in the R,G,B or hex to determine if the txt should be white or black? either way, spiffy
can't wait for the new version, now. heh
Is it in the luaglobal in git head? <ponders compiling>
ETA: did you hardcode all of that, or check some values in the R,G,B or hex to determine if the txt should be white or black? either way, spiffy
Re: Print out all named colors
This is the function, and no.. the LuaGlobal in git head is really old, but if you want I can send you my current version:
Code: Select all
function showColors(...)
local cols = ... or 3
local i = 1
for k,v in pairs(color_table) do
local fg
local luminosity = (0.2126 * ((v[1]/255)^2.2)) + (0.7152 * ((v[2]/255)^2.2)) + (0.0722 * ((v[3]/255)^2.2))
if luminosity > 0.5 then
fg = {0,0,0}
else
fg = {255,255,255}
end
hecho("|c"..RGB2Hex(unpack(fg))..","..RGB2Hex(unpack(v))..k..string.rep(" ", 23-k:len()))
echo" "
if i == cols then
echo"\n"
i = 1
else
i = i + 1
end
end
end
- Alexander Divine
- Posts: 65
- Joined: Mon Dec 21, 2009 7:01 pm
Re: Print out all named colors
Does anyone have a list of which of Mudlet's colors correspond with IRE's 16 colors? I found a few perfect matches, but the rest of my colors are out of whack.
Re: Print out all named colors
None because colors can be user-defined in the settings dialog.
I believe heiko said there will be lua variables which contain the values, though. Or you could use the ansi color codes.
I believe heiko said there will be lua variables which contain the values, though. Or you could use the ansi color codes.