grafX2/share/grafx2/scripts/pal_db_Set6bit.lua
Yves Rizoud 0017fbce72 Lua scripts: Added the 'table' library. Added GPL headers to DawnBringer's scripts (thanks!). 2 cosmetic fixes in scripts.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1391 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2010-03-21 15:43:11 +00:00

40 lines
974 B
Lua

--PALETTE Set: Full 6 Bit (64 colors)
--by Richard Fhager
--http://hem.fyristorg.com/dawnbringer/
-- Copyright 2010 Richard Fhager
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; version 2
-- of the License. See <http://www.gnu.org/licenses/>
-- Generate palette of all colors possible with a given number of shades for each channel
-- 2 shades = 1 bit / channel = 3 bit palette = 2^3 colors = 8 colors
-- 4 shades = 2 bit / channel = 6 bit palette = 2^6 colors = 64 colors
-- Channel shades (shades = 2 ^ bit-depth)
shades = 4
mult = 255 / (shades-1)
colors = {}
col = 0
for r = 0, shades-1, 1 do
for g = 0, shades-1, 1 do
for b = 0, shades-1, 1 do
col = col + 1
colors[col] = { r*mult, g*mult, b*mult }
end
end
end
for c = 1, #colors, 1 do
setcolor(c-1,colors[c][1],colors[c][2],colors[c][3])
end