<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASports_color%2Fsandbox</id>
	<title>Module:Sports color/sandbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASports_color%2Fsandbox"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sports_color/sandbox&amp;action=history"/>
	<updated>2026-04-22T04:39:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sports_color/sandbox&amp;diff=146928&amp;oldid=prev</id>
		<title>imported&gt;Frietjes: Frietjes moved page Module:Basketball color/sandbox to Module:Sports color/sandbox without leaving a redirect: per TfD</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sports_color/sandbox&amp;diff=146928&amp;oldid=prev"/>
		<updated>2018-07-08T14:16:24Z</updated>

		<summary type="html">&lt;p&gt;Frietjes moved page &lt;a href=&quot;/index.php?title=Module:Basketball_color/sandbox&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:Basketball color/sandbox (page does not exist)&quot;&gt;Module:Basketball color/sandbox&lt;/a&gt; to &lt;a href=&quot;/research/Module:Sports_color/sandbox&quot; title=&quot;Module:Sports color/sandbox&quot;&gt;Module:Sports color/sandbox&lt;/a&gt; without leaving a redirect: per TfD&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&lt;br /&gt;
-- This module implements&lt;br /&gt;
-- {{Basketball leagues color}}, {{Basketball color cell}}, {{Basketball color cell2}},&lt;br /&gt;
-- {{NBA color}}, {{NBA color cell}}, {{NBA color cell2}}&lt;br /&gt;
-- {{Euroleague color}}, {{Euroleague color cell}}, {{Euroleague color cell2}}, &lt;br /&gt;
-- {{NBL colour}}, {{NBL colour cell}}, {{NBL colour cell2}},&lt;br /&gt;
-- {{PBA color}}, {{PBA color cell}}, {{PBA color cell2}},&lt;br /&gt;
-- {{KBL color}}, {{KBL color cell}}, {{KBL color cell2}}&lt;br /&gt;
--&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local data_module = &amp;quot;Module:Basketball color/data/sandbox&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local function stripwhitespace(text)&lt;br /&gt;
	return text:match(&amp;quot;^%s*(.-)%s*$&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_colors(team, unknown)&lt;br /&gt;
	team = stripwhitespace(team or &amp;#039;&amp;#039;)&lt;br /&gt;
	unknown = unknown or {&amp;quot;DCDCDC&amp;quot;, &amp;quot;000000&amp;quot;, &amp;quot;000000&amp;quot;, &amp;quot;FFFFFF&amp;quot;}&lt;br /&gt;
	&lt;br /&gt;
	local use_default = {&lt;br /&gt;
		[&amp;quot;&amp;quot;] = 1,&lt;br /&gt;
		[&amp;quot;retired&amp;quot;] = 1,&lt;br /&gt;
		[&amp;quot;free agent&amp;quot;] = 1,&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	local colors = nil&lt;br /&gt;
	&lt;br /&gt;
	if ( team and use_default[team:lower()] ) then&lt;br /&gt;
		colors = {&amp;quot;DCDCDC&amp;quot;, &amp;quot;000000&amp;quot;, &amp;quot;000000&amp;quot;, &amp;quot;FFFFFF&amp;quot;}&lt;br /&gt;
	else&lt;br /&gt;
		local all_colors = mw.loadData(data_module)&lt;br /&gt;
		colors = all_colors[team]&lt;br /&gt;
		if ( colors and type(colors) == &amp;#039;string&amp;#039; ) then&lt;br /&gt;
			colors = all_colors[colors]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return colors or unknown&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function team_color(team, num)&lt;br /&gt;
	local colors = get_colors(team, nil)&lt;br /&gt;
&lt;br /&gt;
	num = tonumber(num:match(&amp;#039;[1-4]&amp;#039;) or &amp;#039;0&amp;#039;)&lt;br /&gt;
	if ( num ) then&lt;br /&gt;
		return colors[num]&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function team_colorcell(team, borderwidth, bg, fg, bd)&lt;br /&gt;
	local colors = get_colors(team, nil)&lt;br /&gt;
	local border = &amp;#039;&amp;#039;&lt;br /&gt;
	borderwidth = borderwidth or &amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	if (borderwidth ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
		border = &amp;#039;border:&amp;#039; .. borderwidth .. &amp;#039;px solid #&amp;#039; .. stripwhitespace(colors[bd]) .. &amp;#039;;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &amp;#039;background-color:#&amp;#039; .. stripwhitespace(colors[bg]) .. &amp;#039;;color:#&amp;#039; .. stripwhitespace(colors[fg]) .. &amp;#039;;&amp;#039; .. border&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function team_check(team, unknown)&lt;br /&gt;
	local colors = get_colors(team, unknown)&lt;br /&gt;
	if type(colors) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		return &amp;#039;known&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		return unknown&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function team_testtable(args, style, data)&lt;br /&gt;
	local teamlist = {}&lt;br /&gt;
	if ( data ) then data_module = data end&lt;br /&gt;
&lt;br /&gt;
    -- helper function&lt;br /&gt;
	local function table_row(t, c)&lt;br /&gt;
		local res = mw.html.create(&amp;#039;&amp;#039;)&lt;br /&gt;
		if( c[1] and c[2] and c[3] and c[4] ) then&lt;br /&gt;
			res:tag(&amp;#039;td&amp;#039;):wikitext(t)&lt;br /&gt;
		else&lt;br /&gt;
			res:tag(&amp;#039;td&amp;#039;):wikitext(t .. &amp;#039; &amp;lt;span class=error&amp;gt;ERROR&amp;lt;/span&amp;gt;&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		for i=1,4 do&lt;br /&gt;
			res:tag(&amp;#039;td&amp;#039;):css(&amp;#039;background-color&amp;#039;, &amp;#039;#&amp;#039; .. stripwhitespace(c[i] or &amp;#039;ERROR&amp;#039;))&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		return tostring(res)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
    -- list of teams&lt;br /&gt;
	if( args and args[1] ) then&lt;br /&gt;
		for k, team in pairs(args) do&lt;br /&gt;
			if type(k) == &amp;#039;number&amp;#039; then&lt;br /&gt;
				table.insert(teamlist, team)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local all_colors = mw.loadData(data_module)&lt;br /&gt;
		for team, colors in pairs( all_colors ) do&lt;br /&gt;
			table.insert(teamlist, team)&lt;br /&gt;
		end&lt;br /&gt;
		table.sort(teamlist)&lt;br /&gt;
		table.insert(teamlist, &amp;#039;Free agent&amp;#039;)&lt;br /&gt;
		table.insert(teamlist, &amp;#039;Retired&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- build table&lt;br /&gt;
	local root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
	root:addClass(&amp;#039;wikitable sortable&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;font-size&amp;#039;, &amp;#039;90%&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;line-height&amp;#039;, &amp;#039;100%&amp;#039;)&lt;br /&gt;
		:cssText(style)&lt;br /&gt;
	local row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Team&amp;#039;)&lt;br /&gt;
	for i=1,4 do&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;unsortable&amp;#039;)&lt;br /&gt;
			:wikitext(i)&lt;br /&gt;
	end&lt;br /&gt;
	for k, team in pairs( teamlist ) do&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:wikitext(table_row(team, get_colors(team)))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.color(frame)&lt;br /&gt;
	local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args&lt;br /&gt;
	return team_color(args[1] or &amp;#039;&amp;#039;, args[2] or &amp;#039;&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.colorcell(frame)&lt;br /&gt;
	local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args&lt;br /&gt;
	return team_colorcell(args[1] or &amp;#039;&amp;#039;, args[&amp;#039;border&amp;#039;] or &amp;#039;&amp;#039;, 1, 2, 3)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.colorcell2(frame)&lt;br /&gt;
	local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args&lt;br /&gt;
	return team_colorcell(args[1] or &amp;#039;&amp;#039;, args[&amp;#039;border&amp;#039;] or &amp;#039;&amp;#039;, 3, 4, 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.check(frame)&lt;br /&gt;
	local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args&lt;br /&gt;
	return team_check(args[1] or &amp;#039;&amp;#039;, args[2] or &amp;#039;&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.testtable(frame)&lt;br /&gt;
	return team_testtable((frame.args[1] ~= nil) and frame.args or frame:getParent().args, frame.args[&amp;#039;style&amp;#039;] or &amp;#039;&amp;#039;, frame.args[&amp;#039;data&amp;#039;])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Frietjes</name></author>
	</entry>
</feed>