<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thegoonshow.co.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AGridiron_color</id>
	<title>Module:Gridiron color - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.thegoonshow.co.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AGridiron_color"/>
	<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Gridiron_color&amp;action=history"/>
	<updated>2026-05-14T04:44:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Gridiron_color&amp;diff=1706&amp;oldid=prev</id>
		<title>Kurt: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Gridiron_color&amp;diff=1706&amp;oldid=prev"/>
		<updated>2022-07-20T18:16:54Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:16, 20 July 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Kurt</name></author>
	</entry>
	<entry>
		<id>https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Gridiron_color&amp;diff=1705&amp;oldid=prev</id>
		<title>en&gt;Charlesaaronthompson: I reverted the module back to this version.</title>
		<link rel="alternate" type="text/html" href="https://www.thegoonshow.co.uk/wiki/index.php?title=Module:Gridiron_color&amp;diff=1705&amp;oldid=prev"/>
		<updated>2021-11-28T22:16:49Z</updated>

		<summary type="html">&lt;p&gt;I reverted the module back to this version.&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;
-- {{Gridiron primary color}} -- {{Gridiron primary color raw}} -- {{Gridiron primary style}}&lt;br /&gt;
-- {{Gridiron secondary color}} -- {{Gridiron secondary color raw}}&lt;br /&gt;
-- {{Gridiron tertiary color raw}}&lt;br /&gt;
-- {{Gridiron alt primary color}} -- {{Gridiron alt primary style}} -- {{Gridiron alt secondary color}}&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local color_data = mw.loadData(&amp;quot;Module:Gridiron color/data&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local yesno = require('Module:Yesno')&lt;br /&gt;
&lt;br /&gt;
local prefixes = {&lt;br /&gt;
	&amp;quot;background: &amp;quot;,&lt;br /&gt;
	&amp;quot;color: &amp;quot;,&lt;br /&gt;
	&amp;quot;/**/&amp;quot;,&lt;br /&gt;
	&amp;quot;background: &amp;quot;,&lt;br /&gt;
	&amp;quot;color: &amp;quot;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
local default = {&amp;quot;#DCDCDC&amp;quot;, &amp;quot;#000000&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
local function get_year(colors, year)&lt;br /&gt;
	if colors and colors[6] and type(colors[6] == 'table') then&lt;br /&gt;
		for team, year_colors in pairs(colors[6]) do&lt;br /&gt;
			if mw.ustring.find(team, &amp;quot;%d%d%d%dthru%d%d%d%d$&amp;quot;) then&lt;br /&gt;
				local start_year, end_year = mw.ustring.match(team, &amp;quot;(%d%d%d%d)thru(%d%d%d%d)$&amp;quot;)&lt;br /&gt;
				if (tonumber(start_year) &amp;lt;= tonumber(year)) and (tonumber(year) &amp;lt;= tonumber(end_year)) then&lt;br /&gt;
					return year_colors&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return colors&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_colors(team, unknown, year)&lt;br /&gt;
	team = (team or ''):match(&amp;quot;^%s*(.-)%s*$&amp;quot;)&lt;br /&gt;
	year = tonumber(year)&lt;br /&gt;
	unknown = unknown or color_data[&amp;quot;#default&amp;quot;] or default&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 = unknown&lt;br /&gt;
	else&lt;br /&gt;
		if mw.ustring.find(team, &amp;quot;%d?%d?%d%dthru%d?%d?%d%d$&amp;quot;) then&lt;br /&gt;
			if (not year or year &amp;lt;= 0) then&lt;br /&gt;
				team, year = mw.ustring.match(team, &amp;quot;^(.-) -(%d?%d?%d%d)thru%d?%d?%d%d$&amp;quot;)&lt;br /&gt;
				team, year = team:match(&amp;quot;^%s*(.-)%s*$&amp;quot;), tonumber(year)&lt;br /&gt;
				&lt;br /&gt;
				if year &amp;gt;= 20 and year &amp;lt; 100 then -- Two-digit years were deprecated in 2018&lt;br /&gt;
					year = year + 1900&lt;br /&gt;
				elseif year &amp;lt; 20 then&lt;br /&gt;
					year = year + 2000&lt;br /&gt;
				elseif year &amp;lt; 1000 then&lt;br /&gt;
					year = nil&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				team = mw.ustring.match(team, &amp;quot;^(.-) -%d?%d?%d%dthru%d?%d?%d%d$&amp;quot;) or team&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if year and year &amp;gt; 0 then&lt;br /&gt;
			--code for handling year parameter&lt;br /&gt;
			colors = get_year(color_data[team], year)&lt;br /&gt;
		else&lt;br /&gt;
			colors = color_data[team]&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if ( colors and type(colors) == 'string') then&lt;br /&gt;
			if team == colors then year = nil end&lt;br /&gt;
			-- follow alias recursively&lt;br /&gt;
			return  get_colors (colors, unknown, year)&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 bordercss(c, w)&lt;br /&gt;
	if w &amp;gt; 0 then&lt;br /&gt;
		local s = 'inset ' .. w .. 'px ' .. w .. 'px 0 ' .. c &lt;br /&gt;
			.. ', inset -' .. w .. 'px -' .. w .. 'px 0 ' .. c&lt;br /&gt;
		return 'box-shadow: ' .. s .. ';'&lt;br /&gt;
	else&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function contrast_check(background, text, colors, alt)&lt;br /&gt;
	local c_limit = 3&lt;br /&gt;
	local contrast = require('Module:Color_contrast')&lt;br /&gt;
	if contrast._ratio({[1] = text, [2] = background, ['error'] = 0}) &amp;lt; c_limit then&lt;br /&gt;
		if contrast._ratio({[1] = '#FFFFFF', [2] = background, ['error'] = 0}) &amp;gt;= c_limit then&lt;br /&gt;
			text = '#FFFFFF'&lt;br /&gt;
		elseif contrast._ratio({[1] = '#000000', [2] = background, ['error'] = 0}) &amp;gt;= c_limit then&lt;br /&gt;
			text = '#000000'&lt;br /&gt;
		elseif (not alt) and (contrast._ratio({[1] = colors[5], [2] = colors[4], ['error'] = 0}) &amp;gt;= c_limit) then&lt;br /&gt;
			background, text = colors[4], colors[5]&lt;br /&gt;
		else&lt;br /&gt;
			background, text = default[1], default[2]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return background, text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.test(frame)&lt;br /&gt;
	local args = frame.args.team and frame.args or frame:getParent().args&lt;br /&gt;
	local colors = get_colors((args.team or args[1]), nil, args.year)&lt;br /&gt;
	return '[&amp;quot;' .. args.team .. '&amp;quot;] = {{ &amp;quot;' .. colors[1] .. '&amp;quot;, '.. colors[2] ..&lt;br /&gt;
		'&amp;quot;, '.. colors[3] .. '&amp;quot;, '.. colors[4] .. '&amp;quot;, '.. colors[5] .. '&amp;quot;}}'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.color(frame, column, altcolumn)&lt;br /&gt;
	local args = frame.args.team and frame.args or frame:getParent().args&lt;br /&gt;
	local colors = get_colors((args.team or args[1]), nil, args.year)&lt;br /&gt;
&lt;br /&gt;
	column = (column or tonumber(frame.args.column)) or 1&lt;br /&gt;
	altcolumn = altcolumn or tonumber(frame.args.altcolumn)&lt;br /&gt;
	if ((not colors[column]) or (colors[column] == '')) and altcolumn then&lt;br /&gt;
		column = altcolumn&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return (yesno(frame.args.raw) and &amp;quot;&amp;quot; or prefixes[column]) .. colors[column]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.style(frame)&lt;br /&gt;
	local team = frame.args.team or frame.args[1] or frame:getParent().args.team or frame:getParent().args[1]&lt;br /&gt;
	local year = frame.args.year or frame:getParent().args.year&lt;br /&gt;
	local border = frame.args.border or frame:getParent().args.border&lt;br /&gt;
	local alt = yesno(frame.args.alt or frame:getParent().args.alt)&lt;br /&gt;
	&lt;br /&gt;
	local colors = get_colors(team, nil, year)&lt;br /&gt;
	&lt;br /&gt;
	local background, text&lt;br /&gt;
	if alt then background, text = colors[4], colors[5] end&lt;br /&gt;
	if ((not background) or (background  == '')) then background = colors[1] end&lt;br /&gt;
	if ((not background) or (background  == '')) then background = default[1] end&lt;br /&gt;
	if ((not text) or (text  == '')) then text = colors[2] end&lt;br /&gt;
	if ((not text) or (text  == '')) then text = default[2] end&lt;br /&gt;
	&lt;br /&gt;
	background, text = contrast_check(background, text, colors, alt)&lt;br /&gt;
	&lt;br /&gt;
	local s = prefixes[1] .. background .. &amp;quot;; &amp;quot; .. prefixes[2] .. text .. &amp;quot;; &amp;quot;&lt;br /&gt;
	if tonumber(border) or yesno(border) then&lt;br /&gt;
		border = tonumber(border) and border or 2&lt;br /&gt;
		s = s .. bordercss(colors[3], tonumber(border))&lt;br /&gt;
	end&lt;br /&gt;
	return '' .. s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>en&gt;Charlesaaronthompson</name></author>
	</entry>
</feed>