<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.agency/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://wiki.agency/index.php?action=history&amp;feed=atom&amp;title=Module%3AGridiron_color"/>
		<link rel="alternate" type="text/html" href="https://wiki.agency/index.php?title=Module:Gridiron_color&amp;action=history"/>
		<updated>2026-04-13T09:28:32Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.1</generator>

	<entry>
		<id>https://wiki.agency/index.php?title=Module:Gridiron_color&amp;diff=5296&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.agency/index.php?title=Module:Gridiron_color&amp;diff=5296&amp;oldid=prev"/>
				<updated>2018-11-04T18:07:35Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 18:07, 4 November 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&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>Admin</name></author>	</entry>

	<entry>
		<id>https://wiki.agency/index.php?title=Module:Gridiron_color&amp;diff=5295&amp;oldid=prev</id>
		<title>Frietjes: fix for border = 0</title>
		<link rel="alternate" type="text/html" href="https://wiki.agency/index.php?title=Module:Gridiron_color&amp;diff=5295&amp;oldid=prev"/>
				<updated>2018-08-10T19:27:29Z</updated>
		
		<summary type="html">&lt;p&gt;fix for border = 0&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(&amp;#039;Module:Yesno&amp;#039;)&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] == &amp;#039;table&amp;#039;) 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 &amp;#039;&amp;#039;):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) == &amp;#039;string&amp;#039;) 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 = &amp;#039;inset &amp;#039; .. w .. &amp;#039;px &amp;#039; .. w .. &amp;#039;px 0 &amp;#039; .. c &lt;br /&gt;
			.. &amp;#039;, inset -&amp;#039; .. w .. &amp;#039;px -&amp;#039; .. w .. &amp;#039;px 0 &amp;#039; .. c&lt;br /&gt;
		return &amp;#039;-moz-box-shadow: &amp;#039; .. s .. &amp;#039;; -webkit-box-shadow: &amp;#039; .. s .. &amp;#039;; box-shadow: &amp;#039; .. s .. &amp;#039;;&amp;#039;&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 contrast_check(background, text, colors, alt)&lt;br /&gt;
	local c_limit = 4.5&lt;br /&gt;
	local contrast = require(&amp;#039;Module:Color_contrast&amp;#039;)&lt;br /&gt;
	if contrast._ratio({[1] = text, [2] = background, [&amp;#039;error&amp;#039;] = 0}) &amp;lt; c_limit then&lt;br /&gt;
		if contrast._ratio({[1] = &amp;#039;#FFFFFF&amp;#039;, [2] = background, [&amp;#039;error&amp;#039;] = 0}) &amp;gt;= c_limit then&lt;br /&gt;
			text = &amp;#039;#FFFFFF&amp;#039;&lt;br /&gt;
		elseif contrast._ratio({[1] = &amp;#039;#000000&amp;#039;, [2] = background, [&amp;#039;error&amp;#039;] = 0}) &amp;gt;= c_limit then&lt;br /&gt;
			text = &amp;#039;#000000&amp;#039;&lt;br /&gt;
		elseif (not alt) and (contrast._ratio({[1] = colors[5], [2] = colors[4], [&amp;#039;error&amp;#039;] = 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;#039;[&amp;quot;&amp;#039; .. args.team .. &amp;#039;&amp;quot;] = {{ &amp;quot;&amp;#039; .. colors[1] .. &amp;#039;&amp;quot;, &amp;#039;.. colors[2] ..&lt;br /&gt;
		&amp;#039;&amp;quot;, &amp;#039;.. colors[3] .. &amp;#039;&amp;quot;, &amp;#039;.. colors[4] .. &amp;#039;&amp;quot;, &amp;#039;.. colors[5] .. &amp;#039;&amp;quot;}}&amp;#039;&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] == &amp;#039;&amp;#039;)) 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  == &amp;#039;&amp;#039;)) then background = colors[1] end&lt;br /&gt;
	if ((not background) or (background  == &amp;#039;&amp;#039;)) then background = default[1] end&lt;br /&gt;
	if ((not text) or (text  == &amp;#039;&amp;#039;)) then text = colors[2] end&lt;br /&gt;
	if ((not text) or (text  == &amp;#039;&amp;#039;)) 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 &amp;#039;&amp;#039; .. s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Frietjes</name></author>	</entry>

	</feed>