<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AGridiron_color%2Fcontrast</id>
	<title>Module:Gridiron color/contrast - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AGridiron_color%2Fcontrast"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Gridiron_color/contrast&amp;action=history"/>
	<updated>2026-06-06T06:45:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Gridiron_color/contrast&amp;diff=471871&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Gridiron_color/contrast&amp;diff=471871&amp;oldid=prev"/>
		<updated>2021-07-15T21:54:21Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&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:Gridiron 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 get_colors(team, unknown)&lt;br /&gt;
	team = stripwhitespace(team or '')&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) == 'string' ) 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({'' .. hex1, '' .. 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 ''&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['style']&lt;br /&gt;
	local data_module = args['data'] or ('Module:Gridiron color/' .. (args['sport'] or 'football'))&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('')&lt;br /&gt;
		if( c[1] ) then&lt;br /&gt;
			res:tag('td'):wikitext(t)&lt;br /&gt;
		else&lt;br /&gt;
			res:tag('td'):wikitext(t .. ' &amp;lt;span class=error&amp;gt;ERROR&amp;lt;/span&amp;gt;')&lt;br /&gt;
		end&lt;br /&gt;
		for i=1,4 do&lt;br /&gt;
			res:tag('td')&lt;br /&gt;
				:css('background', c[i] or 'transparent')&lt;br /&gt;
				:wikitext(c[i] and '' or 'X')&lt;br /&gt;
		end&lt;br /&gt;
		res:tag('td'):wikitext(color_contrast_ratio(c[1],c[2]))&lt;br /&gt;
		res:tag('td'):wikitext(color_contrast_ratio(c[4],c[3]))&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) == 'number' 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) == 'string' then&lt;br /&gt;
				aliaslist[colors] = (aliaslist[colors] or '') .. '&amp;lt;br /&amp;gt;Also known as ' .. 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, 'Free agent')&lt;br /&gt;
		table.insert(teamlist, 'Retired')&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- build table&lt;br /&gt;
	local root = mw.html.create('table')&lt;br /&gt;
	root:addClass('wikitable sortable')&lt;br /&gt;
		:css('background', 'transparent')&lt;br /&gt;
		:css('font-size', '90%')&lt;br /&gt;
		:css('line-height', '100%')&lt;br /&gt;
		:cssText(style)&lt;br /&gt;
	if args['caption'] then&lt;br /&gt;
		root:tag('caption'):wikitext(args['caption'])&lt;br /&gt;
	end&lt;br /&gt;
	local row = root:tag('tr')&lt;br /&gt;
	row:tag('th')&lt;br /&gt;
		:attr('rowspan',2)&lt;br /&gt;
		:wikitext('Team')&lt;br /&gt;
	for i=1,4 do&lt;br /&gt;
		row:tag('th')&lt;br /&gt;
			:addClass('unsortable')&lt;br /&gt;
			:attr('rowspan',2)&lt;br /&gt;
			:wikitext(i)&lt;br /&gt;
	end&lt;br /&gt;
	row:tag('th')&lt;br /&gt;
		:attr('colspan', 2)&lt;br /&gt;
		:wikitext('Contrast')&lt;br /&gt;
	row = root:tag('tr')&lt;br /&gt;
	row:tag('th'):wikitext('1/2')&lt;br /&gt;
	row:tag('th'):wikitext('4/3')&lt;br /&gt;
	for k, team in pairs( teamlist ) do&lt;br /&gt;
		row = root:tag('tr')&lt;br /&gt;
		row:wikitext(table_row(team .. (aliaslist[team] or ''), get_colors(team)))&lt;br /&gt;
	end&lt;br /&gt;
	if style and style ~= '' then&lt;br /&gt;
		style = 'font-size:90%; padding:0.4em; width:32em; border:1px #aaa solid;' .. style&lt;br /&gt;
	end&lt;br /&gt;
	local note = nil&lt;br /&gt;
	if args['note'] then&lt;br /&gt;
		note = args['note']&lt;br /&gt;
	else&lt;br /&gt;
		note = 'The numeric columns are the calculated contrast ratio for the'&lt;br /&gt;
		.. ' first/second and the fourth/third colors. Anything lower than 3 is'&lt;br /&gt;
		.. ' very poor contrast and should be changed in'&lt;br /&gt;
		.. ' [[' .. data_module .. '|the data module]]. For more'&lt;br /&gt;
		.. ' information, see [[Template:Color contrast ratio]].'&lt;br /&gt;
	end&lt;br /&gt;
	if note ~= '' then&lt;br /&gt;
		note = mw.html.create('div'):cssText(style):wikitext(note)&lt;br /&gt;
	end&lt;br /&gt;
	return tostring(root) .. tostring(note)&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;
return contrast&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>