<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://moasspedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ACollege_color%2Fcontrast</id>
	<title>Module:College color/contrast - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://moasspedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ACollege_color%2Fcontrast"/>
	<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Module:College_color/contrast&amp;action=history"/>
	<updated>2026-04-05T16:09:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.2</generator>
	<entry>
		<id>https://moasspedia.org/w/index.php?title=Module:College_color/contrast&amp;diff=897&amp;oldid=prev</id>
		<title>Wikipedia&gt;Frietjes at 16:51, 8 March 2021</title>
		<link rel="alternate" type="text/html" href="https://moasspedia.org/w/index.php?title=Module:College_color/contrast&amp;diff=897&amp;oldid=prev"/>
		<updated>2021-03-08T16:51:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This submodule is used to generate the complete color contrast table in&lt;br /&gt;
-- the documentation for [[Module:College color]]&lt;br /&gt;
local contrast = {}&lt;br /&gt;
local all_colors = {}&lt;br /&gt;
&lt;br /&gt;
local contrast_mod = require(&amp;quot;Module:Color contrast&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 preprocesscitation(text)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*web%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*date%s*=%s*([^|]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;\&amp;quot;[%1 %2]\&amp;quot;. %3. Retrieved %4.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*manual%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*date%s*=%s*([^|]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;&amp;lt;i&amp;gt;[%1 %2]&amp;lt;/i&amp;gt;. %3. Retrieved %4.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*web%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*date%s*=%s*([^|]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;\&amp;quot;[%2 %1]\&amp;quot;. %3. Retrieved %4.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*manual%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*date%s*=%s*([^|]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;&amp;lt;i&amp;gt;[%2 %1]&amp;lt;/i&amp;gt;. %3. Retrieved %4.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*web%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;\&amp;quot;[%1 %2]\&amp;quot;. Retrieved %3.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*manual%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;&amp;lt;i&amp;gt;[%1 %2]&amp;lt;/i&amp;gt;. Retrieved %3.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*web%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;\&amp;quot;[%2 %1]\&amp;quot;. Retrieved %3.&amp;#039;)&lt;br /&gt;
	text = mw.ustring.gsub(text, &amp;#039;%{%{%s*[Cc]ite%s*manual%s*%|%s*title%s*=%s*([^|]-)%s*%|%s*url%s*=%s*([^|%[%]]-)%s*%|%s*access%-?date%s*=%s*([^|]-)%s*%}%}&amp;#039;, &amp;#039;&amp;lt;i&amp;gt;[%2 %1]&amp;lt;/i&amp;gt;. Retrieved %3.&amp;#039;)&lt;br /&gt;
	return text&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;}&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;}&lt;br /&gt;
	else&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 color_contrast_ratio(hex1, hex2)&lt;br /&gt;
	if( hex1 and hex2) then&lt;br /&gt;
		local r = contrast_mod._ratio({&amp;#039;#&amp;#039; .. hex1, &amp;#039;#&amp;#039; .. hex2, error = 0})&lt;br /&gt;
		if( r &amp;gt; 0 ) then&lt;br /&gt;
			r = (r &amp;gt; 1) and r or (1/r)&lt;br /&gt;
			r = math.floor(r * 100 + 0.5) / 100&lt;br /&gt;
			return  (r &amp;gt; 1) and r or (1/r)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function contrast._testtable(args)&lt;br /&gt;
	local teamlist = {}&lt;br /&gt;
	local aliaslist = {}&lt;br /&gt;
	local style = args[&amp;#039;style&amp;#039;]&lt;br /&gt;
	local data_module = args[&amp;#039;data&amp;#039;] or &amp;quot;Module:College color/data&amp;quot;&lt;br /&gt;
	all_colors = mw.loadData(data_module)&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] ) 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,3 do&lt;br /&gt;
			res:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;background&amp;#039;, c[i] and (&amp;#039;#&amp;#039; .. c[i]) or &amp;#039;transparent&amp;#039;)&lt;br /&gt;
				:wikitext(c[i] and &amp;#039;&amp;#039; or &amp;#039;X&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		for i=1,3 do&lt;br /&gt;
			local j = math.fmod(i,3) + 1&lt;br /&gt;
			res:tag(&amp;#039;td&amp;#039;):wikitext(color_contrast_ratio(c[i],c[j]))&lt;br /&gt;
		end&lt;br /&gt;
		res:tag(&amp;#039;td&amp;#039;):wikitext(color_contrast_ratio(c[1],&amp;#039;FFFFFF&amp;#039;))&lt;br /&gt;
		res:tag(&amp;#039;td&amp;#039;):wikitext(color_contrast_ratio(c[1],&amp;#039;000000&amp;#039;))&lt;br /&gt;
		local r = &amp;#039;&amp;#039;&lt;br /&gt;
		for k, v in pairs(c) do&lt;br /&gt;
			if ( type(k) == &amp;#039;string&amp;#039; and mw.ustring.match(k, &amp;#039;^cite&amp;#039;) ) then&lt;br /&gt;
				r = r .. &amp;#039;&amp;lt;ref&amp;gt;&amp;#039; .. preprocesscitation(v) .. &amp;#039;&amp;lt;/ref&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
			if( type(k) == &amp;#039;string&amp;#039; and mw.ustring.match(k, &amp;#039;^ref&amp;#039;) ) then&lt;br /&gt;
				local rt = mw.ustring.gsub(v, &amp;#039;^%s*https?://(.*)&amp;#039;, &amp;#039;%1&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
				rt = mw.ustring.gsub(rt, &amp;#039;^(.-)/.*&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
				rt = mw.ustring.gsub(rt, &amp;#039;^www%.(.-)$&amp;#039;, &amp;#039;%1&amp;#039;) or rt &lt;br /&gt;
				r = r .. &amp;#039;&amp;lt;ref&amp;gt;[&amp;#039; .. v .. &amp;#039; &amp;#039; .. rt .. &amp;#039;]&amp;lt;/ref&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		res:tag(&amp;#039;td&amp;#039;):wikitext(r)&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;
		for team, colors in pairs( all_colors ) do&lt;br /&gt;
			if type(colors) == &amp;#039;string&amp;#039; then&lt;br /&gt;
				aliaslist[colors] = (aliaslist[colors] or &amp;#039;&amp;#039;) .. &amp;#039;&amp;lt;br /&amp;gt;aka &amp;#039; .. team&lt;br /&gt;
			else&lt;br /&gt;
				table.insert(teamlist, team)&lt;br /&gt;
			end&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;background&amp;#039;, &amp;#039;transparent&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;)&lt;br /&gt;
		:attr(&amp;#039;rowspan&amp;#039;,2)&lt;br /&gt;
		:wikitext(&amp;#039;Team&amp;#039;)&lt;br /&gt;
	for i=1,3 do&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;unsortable&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;rowspan&amp;#039;,2)&lt;br /&gt;
			:wikitext(i)&lt;br /&gt;
	end&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;colspan&amp;#039;, 5)&lt;br /&gt;
		:wikitext(&amp;#039;Contrast&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		:attr(&amp;#039;rowspan&amp;#039;,2)&lt;br /&gt;
		:wikitext(&amp;#039;refs&amp;#039;)&lt;br /&gt;
	row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	for i=1,3 do&lt;br /&gt;
		local j = math.fmod(i,3) + 1&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):wikitext(i .. &amp;#039;/&amp;#039; .. j)&lt;br /&gt;
	end&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;1/w&amp;#039;)&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;1/b&amp;#039;)&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 .. (aliaslist[team] or &amp;#039;&amp;#039;), get_colors(team)))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return tostring(root) .. &amp;#039;{{hidden begin|title=References|toggle=left}}{{reflist}}{{hidden end}}&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function contrast._exampletable(frame, args, styletemplate)&lt;br /&gt;
	local teamlist = {}&lt;br /&gt;
	local style = args[&amp;#039;style&amp;#039;]&lt;br /&gt;
	local data_module = args[&amp;#039;data&amp;#039;] or &amp;quot;Module:College color/data&amp;quot;&lt;br /&gt;
	all_colors = mw.loadData(data_module)&lt;br /&gt;
	&lt;br /&gt;
	local function stripestyle(frame, in_args)&lt;br /&gt;
		return frame:expandTemplate{ title = styletemplate, args = in_args }&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;
		for team, colors in pairs( all_colors ) do&lt;br /&gt;
			if type(colors) ~= &amp;#039;string&amp;#039; then&lt;br /&gt;
				table.insert(teamlist, team)&lt;br /&gt;
			end&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;
	if( args[&amp;#039;title&amp;#039;] ) then&lt;br /&gt;
		root:tag(&amp;#039;caption&amp;#039;):wikitext(args[&amp;#039;title&amp;#039;])&lt;br /&gt;
	end&lt;br /&gt;
	root:addClass(&amp;#039;infobox&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
		:cssText(style)&lt;br /&gt;
	for k, team in pairs( teamlist ) do&lt;br /&gt;
		local cell = root:tag(&amp;#039;tr&amp;#039;):tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
		cell&lt;br /&gt;
			:cssText(stripestyle(frame,{team}))&lt;br /&gt;
			:wikitext(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 contrast.testtable(frame)&lt;br /&gt;
	return frame:preprocess(contrast._testtable(frame.args))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function contrast.stripetable(frame)&lt;br /&gt;
	return contrast._exampletable(frame,frame.args, &amp;#039;College stripe style&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function contrast.header1table(frame)&lt;br /&gt;
	return contrast._exampletable(frame,frame.args, &amp;#039;NCAA color cell&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function contrast.header2table(frame)&lt;br /&gt;
	return contrast._exampletable(frame,frame.args, &amp;#039;NCAA secondary color cell&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return contrast&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Frietjes</name></author>
	</entry>
</feed>