<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3AComplForColorModules</id>
	<title>Module:ComplForColorModules - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.vigyanwiki.in/index.php?action=history&amp;feed=atom&amp;title=Module%3AComplForColorModules"/>
	<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:ComplForColorModules&amp;action=history"/>
	<updated>2026-04-28T04:45:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://www.vigyanwiki.in/index.php?title=Module:ComplForColorModules&amp;diff=23712&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:ComplForColorModules&amp;diff=23712&amp;oldid=prev"/>
		<updated>2022-11-15T03:41:55Z</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-GB&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 09:11, 15 November 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&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://www.vigyanwiki.in/index.php?title=Module:ComplForColorModules&amp;diff=23711&amp;oldid=prev</id>
		<title>wikipedia&gt;Pppery: Replace usage of to-be-deleted Module:SimpleArgs, clean up code with nested functions to be slightly more readable</title>
		<link rel="alternate" type="text/html" href="https://www.vigyanwiki.in/index.php?title=Module:ComplForColorModules&amp;diff=23711&amp;oldid=prev"/>
		<updated>2019-12-09T23:34:52Z</updated>

		<summary type="html">&lt;p&gt;Replace usage of to-be-deleted &lt;a href=&quot;/index.php?title=Module:SimpleArgs&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Module:SimpleArgs (page does not exist)&quot;&gt;Module:SimpleArgs&lt;/a&gt;, clean up code with nested functions to be slightly more readable&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local TNTT = require &amp;quot;Module:TNTTools&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local I18n = 'ComplForColorModules'&lt;br /&gt;
&lt;br /&gt;
--local MoreOneNoData = &amp;quot;Found 2 legends of \&amp;quot;Value not assigned\&amp;quot; or \&amp;quot;Data not available\&amp;quot;&amp;quot;&lt;br /&gt;
--local FoundNLegendsExpectedN = &amp;quot;Found $1 legends, expected $2&amp;quot;&lt;br /&gt;
--local Color = &amp;quot;Color&amp;quot;&lt;br /&gt;
--local Legend = &amp;quot;legend&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local function I18nStr (S, ...)&lt;br /&gt;
	return TNTT.GetMsgP (I18n, S, {...})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.ColorNameInvFromS0 (S)&lt;br /&gt;
	local IsInv = false&lt;br /&gt;
	local ColorName = ''&lt;br /&gt;
	local Params = {}&lt;br /&gt;
	if S ~= '' then&lt;br /&gt;
		for w in S:gmatch(&amp;quot;([^_]+)&amp;quot;) do &lt;br /&gt;
	    	table.insert(Params, w)&lt;br /&gt;
		end&lt;br /&gt;
		ColorName = Params[1]&lt;br /&gt;
	end	&lt;br /&gt;
	local PN = table.getn(Params)&lt;br /&gt;
	if (PN == 2) and (Params[2]=='i') then&lt;br /&gt;
		IsInv = true&lt;br /&gt;
	end	&lt;br /&gt;
	return ColorName, IsInv, Params&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.ColorNameInv (args)&lt;br /&gt;
	local ColorName, IsInv, Params = p.ColorNameInvFromS0(args[1])&lt;br /&gt;
	return ColorName, IsInv			    	&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
function p.GetLabels(Args, N, Pos)&lt;br /&gt;
    local Labels = {}&lt;br /&gt;
    local index = Pos&lt;br /&gt;
    while Args[index] do&lt;br /&gt;
    	Labels[#Labels+1] = Args[index]&lt;br /&gt;
    	index = index + 1&lt;br /&gt;
    end&lt;br /&gt;
    local NLabels = #Labels&lt;br /&gt;
    local OutlineColor = Args['outline'] or ''&lt;br /&gt;
    if (NLabels ~= 0) and (NLabels ~= N) then&lt;br /&gt;
    	local StartUnknown = (string.sub(Labels[1],1,2) == &amp;quot;--&amp;quot;)&lt;br /&gt;
    	local EndUnknown = (string.sub(Labels[NLabels],1,2) == &amp;quot;--&amp;quot;)&lt;br /&gt;
    	if StartUnknown and EndUnknown then&lt;br /&gt;
	    	error (I18nStr ('MoreOneNoData'))&lt;br /&gt;
    	elseif StartUnknown or EndUnknown then&lt;br /&gt;
    		N = N + 1&lt;br /&gt;
    	end	&lt;br /&gt;
		if (NLabels ~= 0) and (NLabels ~= N) then&lt;br /&gt;
	    	error (I18nStr ('FoundNLegendsExpectedN', tostring(NLabels), tostring(N)))&lt;br /&gt;
	    end&lt;br /&gt;
	end&lt;br /&gt;
    return Labels, NLabels, OutlineColor&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function SColor (Color)&lt;br /&gt;
	if string.sub(Color,1,1) == '#' then --the usual&lt;br /&gt;
		return string.sub(Color,2,100)&lt;br /&gt;
	else&lt;br /&gt;
		return Color&lt;br /&gt;
	end	&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
function p.Box(Color,WriteColor)&lt;br /&gt;
	if WriteColor == '-' then &lt;br /&gt;
		WriteColor = Color&lt;br /&gt;
	elseif WriteColor == 'a' then 	&lt;br /&gt;
		WriteColor = Color..'ff' --Alpha channel&lt;br /&gt;
	end	&lt;br /&gt;
	local TheBox = '&amp;lt;span style=&amp;quot;background-color:'..Color..'; border:1px solid gray;&amp;quot; title=&amp;quot;'..TNTT.GetStrP(I18n,'Color')..': '..SColor(Color)..'&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/span&amp;gt;'	&lt;br /&gt;
	if WriteColor ~='' then &lt;br /&gt;
		TheBox = TheBox..'&amp;amp;nbsp;'..WriteColor..' &amp;amp;nbsp;'&lt;br /&gt;
	end	&lt;br /&gt;
	return TheBox&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
function p.TextWithTooltip (Text, Tooltip)&lt;br /&gt;
	if Tooltip ~= '' then&lt;br /&gt;
		return '&amp;lt;span title=&amp;quot;'..Tooltip..'&amp;quot;&amp;gt;'..Text..'&amp;lt;/span&amp;gt;'&lt;br /&gt;
	else&lt;br /&gt;
		return Text&lt;br /&gt;
	end	&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
function p.LegendColor(Color, Text, Tooltip)&lt;br /&gt;
	if Text == '' then&lt;br /&gt;
		Text = SColor(Color)&lt;br /&gt;
	end	&lt;br /&gt;
	return '&amp;lt;li style=&amp;quot;list-style-type: none; list-style-image: none;&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;border:1px solid gray; background:'..Color..'; margin-right:0.3em; vertical-align: middle; webkit-print-color-adjust:exact; color-adjust:exact; display:inline-block; width:1.05em; height:1em;&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;'..p.TextWithTooltip(Text,Tooltip)..'&amp;lt;/li&amp;gt;'&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
function LegendCode(Color, Text, OutlineColor)&lt;br /&gt;
	local SOutlineColor = ''&lt;br /&gt;
	if OutlineColor ~= '' then&lt;br /&gt;
		SOutlineColor = '|outline='..OutlineColor&lt;br /&gt;
	end	&lt;br /&gt;
	return '{{'..TNTT.GetStrP(I18n,'Legend')..'|'..Color..'|'..Text..SOutlineColor..'}}'&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
function p.LegendText (AColors, Labels, NLabels, ColWidth, IsTemplate, OutlineColor)&lt;br /&gt;
	if ColWidth then &lt;br /&gt;
		ColWidth = mw.text.trim(ColWidth)&lt;br /&gt;
		if #ColWidth == 0 then&lt;br /&gt;
			ColWidth = nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local Show, Codes = {}, {}&lt;br /&gt;
	local Text = ''&lt;br /&gt;
	local WithLabels = NLabels &amp;gt; 0&lt;br /&gt;
	if WithLabels then&lt;br /&gt;
		local Gray = '#b3b3b3' -- A 40% gray&lt;br /&gt;
		if string.sub(Labels[1],1,2) == '--' then&lt;br /&gt;
			table.insert(AColors, 1, Gray) &lt;br /&gt;
			Labels[1] = string.sub(Labels[1], 3, 1000)&lt;br /&gt;
		elseif string.sub(Labels[NLabels],1,2) == '--' then&lt;br /&gt;
			table.insert(AColors, Gray) &lt;br /&gt;
			Labels[NLabels] = string.sub(Labels[NLabels], 3, 1000)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	for i=1, table.getn(AColors) do&lt;br /&gt;
		if WithLabels then Text = Labels[i] end&lt;br /&gt;
		table.insert(Show, p.LegendColor(AColors[i],Text,''))&lt;br /&gt;
	end	&lt;br /&gt;
	SShow = table.concat(Show,&amp;quot;\n&amp;quot;)&lt;br /&gt;
	if ColWidth then &lt;br /&gt;
		local frame = mw.getCurrentFrame()&lt;br /&gt;
		SShow = frame:expandTemplate{title=&amp;quot;div col&amp;quot;,args={colwidth=ColWidth}} .. SShow&lt;br /&gt;
		SShow = SShow .. frame:expandTemplate{title=&amp;quot;div col end&amp;quot;}&lt;br /&gt;
	end&lt;br /&gt;
	for i=1, table.getn(AColors) do&lt;br /&gt;
		if WithLabels then Text = Labels[i] end&lt;br /&gt;
		table.insert(Codes, ' '..LegendCode(AColors[i],Text,OutlineColor))&lt;br /&gt;
	end	&lt;br /&gt;
	local SCodes = '&amp;lt;pre&amp;gt;\n'&lt;br /&gt;
	if ColWidth then&lt;br /&gt;
		SCodes = SCodes .. require(&amp;quot;Module:Template invocation&amp;quot;).invocation(&amp;quot;div col&amp;quot;,{colwidth=ColWidth}) .. &amp;quot;\n&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	SCodes = SCodes .. table.concat(Codes,&amp;quot;\n&amp;quot;)&lt;br /&gt;
	if ColWidth and #ColWidth ~= 0 then&lt;br /&gt;
		SCodes = SCodes .. &amp;quot;\n{{div col end}}&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	SCodes = SCodes .. &amp;quot;\n&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
	return SShow..'\n'..SCodes&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Pppery</name></author>
	</entry>
</feed>