Module:TierColour/data: Difference between revisions

From SmashWiki, the Super Smash Bros. wiki
Jump to navigationJump to search
(first draft)
 
No edit summary
Line 15: Line 15:
newCol = {0,0,0}
newCol = {0,0,0}
for i,v in ipairs(arg) do
for i,v in ipairs(arg) do
newCol[0] = newCol[0] + v[0]
newCol[1] = newCol[1] + v[1]
newCol[1] = newCol[1] + v[1]
newCol[2] = newCol[2] + v[2]
newCol[2] = newCol[2] + v[2]
newCol[3] = newCol[3] + v[3]
end
end
newCol[0] = newCol[0] / arg[n]
newCol[1] = newCol[1] / arg[n]
newCol[1] = newCol[1] / arg[n]
newCol[2] = newCol[2] / arg[n]
newCol[2] = newCol[2] / arg[n]
newCol[3] = newCol[3] / arg[n]
return newCol
return newCol
end
end

Revision as of 19:30, February 15, 2024

Documentation for this module may be created at Module:TierColour/data/doc

local RED = {255,0,0}
local ORG = {255,127,0}
local YLW = {255,255,0}
local CHR = {127,255,0}
local GRN = {0,255,0}
local AQU = {0,255,127}
local CYN = {0,255,255}
local AZR = {0,127,255}
local BLU = {0,0,255}
local VIO = {127,0,255}
local MGN = {255,0,255}
local PRP = {127,0,127}

function col_avg(...)
	newCol = {0,0,0}
	for i,v in ipairs(arg) do
		newCol[1] = newCol[1] + v[1]
		newCol[2] = newCol[2] + v[2]
		newCol[3] = newCol[3] + v[3]
	end
	newCol[1] = newCol[1] / arg[n]
	newCol[2] = newCol[2] / arg[n]
	newCol[3] = newCol[3] / arg[n]
	return newCol
end

local tierColourList = {
	[4] = {RED, YLY, GRN, BLU},
	[5] = {RED, ORG, YLY, GRN, BLU},
	[6] = {RED, ORG, YLY, GRN, BLU, PRP},
}

return tierColourList