打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

RIA Wiki 已更新到 1.41!部分 CSS 在新版本下可能有不同的表现,请编辑者注意检查和修改。 目前wiki关闭了自行注册账号的功能,如需注册账号,请查阅Help:注册账号

模块:Rail line:修订间差异

来自RIA | Wiki
秋月白留言 | 贡献
无编辑摘要
秋月白留言 | 贡献
无编辑摘要
第3行: 第3行:
-- 颜色配置表 - 只需编辑这个表
-- 颜色配置表 - 只需编辑这个表
local colorConfig = {
local colorConfig = {
    -- ZTH轨道交通结社配置
-- ZTH轨道交通结社配置
    R = {
R = {
        lines = {
lines = {
["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" },
["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" },
["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" },
["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" },
["L"] = { bgc1 = "#FF69B4", color2 = "#FF69B4" },
["L"] = { bgc1 = "#FF69B4", color2 = "#FF69B4" },
["Z"] = { bgc1 = "#191970", color2 = "#191970" },
["Z"] = { bgc1 = "#191970", color2 = "#191970" },
        },
},
        default = { bgc1 = "#cccccc", color2 = "#cccccc" }
default = { bgc1 = "#cccccc", color2 = "#cccccc" }
    },
},
   
    -- 海华铁路局配置
-- 海华铁路局配置
    H = {
H = {
        lines = {
lines = {
            ["1"] = { bgc1 = "#ff0000" },
["1"] = { bgc1 = "#ff0000" },
            ["1<small>01</small>"] = { bgc1 = "#ff0000" },
["1<small>01</small>"] = { bgc1 = "#ff0000" },
            ["2"] = { bgc1 = "#ff7f00" },
["2"] = { bgc1 = "#ff7f00" },
            ["2<small>01</small>"] = { bgc1 = "#ff7f00" },
["2<small>01</small>"] = { bgc1 = "#ff7f00" },
            ["3"] = { bgc1 = "#ffdf00" },
["3"] = { bgc1 = "#ffdf00" },
            ["3<small>01</small>"] = { bgc1 = "#ffdf00" },
["3<small>01</small>"] = { bgc1 = "#ffdf00" },
            ["4"] = { bgc1 = "#00ff00" },
["4"] = { bgc1 = "#00ff00" },
            ["5"] = { bgc1 = "#00bfbf" },
["5"] = { bgc1 = "#00bfbf" },
            ["6"] = { bgc1 = "#0000ff" },
["6"] = { bgc1 = "#0000ff" },
            ["6<small>01</small>"] = { bgc1 = "#0000ff" },
["6<small>01</small>"] = { bgc1 = "#0000ff" },
            ["7"] = { bgc1 = "#7f00ff" },
["7"] = { bgc1 = "#7f00ff" },
            ["10"] = { bgc1 = "#4b5931" },
["10"] = { bgc1 = "#4b5931" },
        },
},
        default = { bgc1 = "#cccccc" }
default = { bgc1 = "#cccccc" }
    },
},
   
    -- 溯铁集团配置
-- 溯铁集团配置
    T = {
T = {
        lines = {
lines = {
            ["8"] = { bgc1 = "#e6722c" },
["8"] = { bgc1 = "#e6722c" },
            ["14"] = { bgc1 = "#a5459b" },
["14"] = { bgc1 = "#a5459b" },
        },
},
        default = { bgc1 = "#cccccc" }
default = { bgc1 = "#cccccc" }
    },
},
   
    -- 白马川铁路局配置
-- 白马川铁路局配置
    B = {
B = {
    lines = {
lines = {
    ["6"] = { bgc1 = "#b5d204" },
["6"] = { bgc1 = "#b5d204" },
    ["7"] = { bgc1 = "#e0231b" },
["7"] = { bgc1 = "#e0231b" },
    },
},
    default = { bgc1 = "#cccccc" }
default = { bgc1 = "#cccccc" }
    },
},
   
    -- 大站快线配置
-- 大站快线配置
    G = {
G = {
        lines = {
lines = {
            ["1"] = { bgc1 = "#ffdc1e" },
["1"] = { bgc1 = "#ffdc1e" },
        },
},
        default = { bgc1 = "#cccccc" }
default = { bgc1 = "#cccccc" }
    },
},
   
    -- 全局默认配置(当路局未配置时使用)
-- 全局默认配置(当路局未配置时使用)
    default = {
default = {
        bgc1 = "#cccccc",
bgc1 = "#cccccc",
        color2 = "#cccccc"
color2 = "#cccccc"
    }
}
}
}


第69行: 第69行:


function p.railBox(frame)
function p.railBox(frame)
    local args = frame.args
local args = frame.args
   
    local system = args.system or args[1] or ""
local system = args.system or args[1] or ""
    local line = args.line or args[2] or ""
local line = args.line or args[2] or ""
    local station = args.station or args[3]
local station = args.station or args[3]
    local inline = args.inline or args[4]
local inline = args.inline or args[4]
   
    local bureau = system:upper()
local bureau = system:upper()
   
    local bureauConfig = colorConfig[bureau]
local bureauConfig = colorConfig[bureau]
    local colors = {}
local colors = {}
   
    if bureauConfig then
if bureauConfig then
        local lineConfig = bureauConfig.lines and bureauConfig.lines[line]
local lineConfig = bureauConfig.lines and bureauConfig.lines[line]
       
        if lineConfig then
if lineConfig then
            colors.bgc1 = lineConfig.bgc1 or bureauConfig.default.bgc1
colors.bgc1 = lineConfig.bgc1 or bureauConfig.default.bgc1
            colors.color2 = lineConfig.color2 or bureauConfig.default.color2
colors.color2 = lineConfig.color2 or bureauConfig.default.color2
        else
else
            colors.bgc1 = bureauConfig.default.bgc1
colors.bgc1 = bureauConfig.default.bgc1
            colors.color2 = bureauConfig.default.color2
colors.color2 = bureauConfig.default.color2
        end
end
    else
else
        colors.bgc1 = colorConfig.default.bgc1
colors.bgc1 = colorConfig.default.bgc1
        colors.color2 = colorConfig.default.color2
colors.color2 = colorConfig.default.color2
    end
end
   
    local templateArgs = {
local templateArgs = {
        system = system,
system = system,
        line = line,
line = line,
    }
}
   
    if station and station ~= "" then
if station and station ~= "" then
        templateArgs.station = station
templateArgs.station = station
    end
end
   
    templateArgs["color-system"] = "white"
templateArgs["color-system"] = "white"
    templateArgs["bgc-system"] = colors.bgc1
templateArgs["bgc-system"] = colors.bgc1
   
    if colors.color2 then
if colors.color2 then
        templateArgs["color-line"] = colors.color2
templateArgs["color-line"] = colors.color2
    end
end
   
    if inline and inline ~= "" then
if inline and inline ~= "" then
        templateArgs.inline = inline
templateArgs.inline = inline
    end
end
   
    return frame:expandTemplate{
return frame:expandTemplate{
        title = 'Rail_line_box',
title = 'Rail_line_box',
        args = templateArgs
args = templateArgs
    }
}
end
end


return p
return p

2026年2月10日 (二) 19:52的版本

模块文档

颜色配置维护指南

若需要添加新的路局与线路,请在本模块中编辑代码并保存。

格式:

新路局代号 = {
    lines = {
        ["线路代号"] = { bgc1 = "颜色代码", color2 = "颜色代码" },  -- 需要color2时
        ["线路代号"] = { bgc1 = "颜色代码" },                       -- 不需要color2时
    },
    default = { bgc1 = "默认颜色", color2 = "默认颜色" }  -- color2可选
},

添加新线路

  1. 找到对应铁路局的配置
  2. lines 表中添加新线路
  3. 保存页面

修改颜色

  1. 找到对应的线路配置
  2. 修改 bgc1color2 的值
  3. 保存页面
local p = {}

-- 颜色配置表 - 只需编辑这个表
local colorConfig = {
	-- ZTH轨道交通结社配置
	R = {
		lines = {
			["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" },
			["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" },
			["L"] = { bgc1 = "#FF69B4", color2 = "#FF69B4" },
			["Z"] = { bgc1 = "#191970", color2 = "#191970" },
		},
		default = { bgc1 = "#cccccc", color2 = "#cccccc" }
	},
	
	-- 海华铁路局配置
	H = {
		lines = {
			["1"] = { bgc1 = "#ff0000" },
			["1<small>01</small>"] = { bgc1 = "#ff0000" },
			["2"] = { bgc1 = "#ff7f00" },
			["2<small>01</small>"] = { bgc1 = "#ff7f00" },
			["3"] = { bgc1 = "#ffdf00" },
			["3<small>01</small>"] = { bgc1 = "#ffdf00" },
			["4"] = { bgc1 = "#00ff00" },
			["5"] = { bgc1 = "#00bfbf" },
			["6"] = { bgc1 = "#0000ff" },
			["6<small>01</small>"] = { bgc1 = "#0000ff" },
			["7"] = { bgc1 = "#7f00ff" },
			["10"] = { bgc1 = "#4b5931" },
		},
		default = { bgc1 = "#cccccc" }
	},
	
	-- 溯铁集团配置
	T = {
		lines = {
			["8"] = { bgc1 = "#e6722c" },
			["14"] = { bgc1 = "#a5459b" },
		},
		default = { bgc1 = "#cccccc" }
	},
	
	-- 白马川铁路局配置
	B = {
		lines = {
			["6"] = { bgc1 = "#b5d204" },
			["7"] = { bgc1 = "#e0231b" },
		},
		default = { bgc1 = "#cccccc" }
	},
	
	-- 大站快线配置
	G = {
		lines = {
			["1"] = { bgc1 = "#ffdc1e" },
		},
		default = { bgc1 = "#cccccc" }
	},
	
	-- 全局默认配置(当路局未配置时使用)
	default = {
		bgc1 = "#cccccc",
		color2 = "#cccccc"
	}
}

-- 以下为主函数,仅添加线路时无需更改

function p.railBox(frame)
	local args = frame.args
	
	local system = args.system or args[1] or ""
	local line = args.line or args[2] or ""
	local station = args.station or args[3]
	local inline = args.inline or args[4]
	
	local bureau = system:upper()
	
	local bureauConfig = colorConfig[bureau]
	local colors = {}
	
	if bureauConfig then
		local lineConfig = bureauConfig.lines and bureauConfig.lines[line]
		
		if lineConfig then
			colors.bgc1 = lineConfig.bgc1 or bureauConfig.default.bgc1
			colors.color2 = lineConfig.color2 or bureauConfig.default.color2
		else
			colors.bgc1 = bureauConfig.default.bgc1
			colors.color2 = bureauConfig.default.color2
		end
	else
		colors.bgc1 = colorConfig.default.bgc1
		colors.color2 = colorConfig.default.color2
	end
	
	local templateArgs = {
		system = system,
		line = line,
	}
	
	if station and station ~= "" then
		templateArgs.station = station
	end
	
	templateArgs["color-system"] = "white"
	templateArgs["bgc-system"] = colors.bgc1
	
	if colors.color2 then
		templateArgs["color-line"] = colors.color2
	end
	
	if inline and inline ~= "" then
		templateArgs.inline = inline
	end
	
	return frame:expandTemplate{
		title = 'Rail_line_box',
		args = templateArgs
	}
end

return p