<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.citizons.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_Custom</id>
	<title>Module:Infobox Custom - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.citizons.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_Custom"/>
	<link rel="alternate" type="text/html" href="https://wiki.citizons.org/index.php?title=Module:Infobox_Custom&amp;action=history"/>
	<updated>2026-04-13T15:41:13Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.citizons.org/index.php?title=Module:Infobox_Custom&amp;diff=268&amp;oldid=prev</id>
		<title>PasbellettiKikka：​创建页面，内容为“local p = {}  -- 计算亮度：返回 true 表示背景较亮，用黑字；false 表示背景暗，用白字 local function isLightColor(color)     local r, g, b      -- 处理 rgb(r, g, b)     r, g, b = color:match(&quot;rgb%((%d+),%s*(%d+),%s*(%d+)%)&quot;)     if r and g and b then         r, g, b = tonumber(r), tonumber(g), tonumber(b)     else         -- 处理十六进制 #rrggbb         local hex = color:match(&quot;#(%x%x%x%x%x%x)&quot;)         if hex then             r…”</title>
		<link rel="alternate" type="text/html" href="https://wiki.citizons.org/index.php?title=Module:Infobox_Custom&amp;diff=268&amp;oldid=prev"/>
		<updated>2025-04-24T02:38:33Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“local p = {}  -- 计算亮度：返回 true 表示背景较亮，用黑字；false 表示背景暗，用白字 local function isLightColor(color)     local r, g, b      -- 处理 rgb(r, g, b)     r, g, b = color:match(&amp;quot;rgb%((%d+),%s*(%d+),%s*(%d+)%)&amp;quot;)     if r and g and b then         r, g, b = tonumber(r), tonumber(g), tonumber(b)     else         -- 处理十六进制 #rrggbb         local hex = color:match(&amp;quot;#(%x%x%x%x%x%x)&amp;quot;)         if hex then             r…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
-- 计算亮度：返回 true 表示背景较亮，用黑字；false 表示背景暗，用白字&lt;br /&gt;
local function isLightColor(color)&lt;br /&gt;
    local r, g, b&lt;br /&gt;
&lt;br /&gt;
    -- 处理 rgb(r, g, b)&lt;br /&gt;
    r, g, b = color:match(&amp;quot;rgb%((%d+),%s*(%d+),%s*(%d+)%)&amp;quot;)&lt;br /&gt;
    if r and g and b then&lt;br /&gt;
        r, g, b = tonumber(r), tonumber(g), tonumber(b)&lt;br /&gt;
    else&lt;br /&gt;
        -- 处理十六进制 #rrggbb&lt;br /&gt;
        local hex = color:match(&amp;quot;#(%x%x%x%x%x%x)&amp;quot;)&lt;br /&gt;
        if hex then&lt;br /&gt;
            r = tonumber(hex:sub(1, 2), 16)&lt;br /&gt;
            g = tonumber(hex:sub(3, 4), 16)&lt;br /&gt;
            b = tonumber(hex:sub(5, 6), 16)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if r and g and b then&lt;br /&gt;
        local luminance = 0.299 * r + 0.587 * g + 0.114 * b&lt;br /&gt;
        return luminance &amp;gt; 186&lt;br /&gt;
    else&lt;br /&gt;
        return true -- 无法判断时默认使用黑字&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.render(frame)&lt;br /&gt;
    local args = frame:getParent().args&lt;br /&gt;
    local output = {}&lt;br /&gt;
&lt;br /&gt;
    local title = args[&amp;#039;标题&amp;#039;] or &amp;#039;未命名条目&amp;#039;&lt;br /&gt;
    local color = args[&amp;#039;颜色&amp;#039;] or &amp;#039;#e8e8e8&amp;#039;&lt;br /&gt;
    local useBlackText = isLightColor(color)&lt;br /&gt;
    local fontColor = useBlackText and &amp;#039;#000&amp;#039; or &amp;#039;#fff&amp;#039;&lt;br /&gt;
&lt;br /&gt;
    table.insert(output, &amp;#039;{| class=&amp;quot;infobox&amp;quot; style=&amp;quot;width:280px; font-size:90%; text-align:left; background:#f9f9f9; border:1px solid #aaa; border-collapse:collapse;&amp;quot;&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
    table.insert(output, string.format(&amp;#039;|-\n! colspan=&amp;quot;2&amp;quot; style=&amp;quot;text-align:center; font-size:130%%; font-weight:bold; background:%s; color:%s; padding:8px;&amp;quot; | %s&amp;#039;,&lt;br /&gt;
        color, fontColor, title))&lt;br /&gt;
&lt;br /&gt;
    if args[&amp;#039;图片&amp;#039;] and args[&amp;#039;图片&amp;#039;] ~= &amp;#039;&amp;#039; then&lt;br /&gt;
        table.insert(output, &amp;#039;|-\n| colspan=&amp;quot;2&amp;quot; style=&amp;quot;text-align:center;&amp;quot; | [[File:&amp;#039; .. args[&amp;#039;图片&amp;#039;] .. &amp;#039;|center|200px]]&amp;#039;)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    for k, v in pairs(args) do&lt;br /&gt;
        if k ~= &amp;#039;标题&amp;#039; and k ~= &amp;#039;图片&amp;#039; and k ~= &amp;#039;颜色&amp;#039; and v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
            table.insert(output, &amp;#039;|-\n| style=&amp;quot;width:40%; font-weight:bold;&amp;quot; | &amp;#039; .. k .. &amp;#039; || &amp;#039; .. v)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    table.insert(output, &amp;#039;|}&amp;#039;)&lt;br /&gt;
    return table.concat(output, &amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>PasbellettiKikka</name></author>
	</entry>
</feed>