模块:Rail line:修订间差异
来自RIA | Wiki
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第27行: | 第27行: | ||
["6<small>01</small>"] = { bgc1 = "#0000ff" }, | ["6<small>01</small>"] = { bgc1 = "#0000ff" }, | ||
["7"] = { bgc1 = "#7f00ff" }, | ["7"] = { bgc1 = "#7f00ff" }, | ||
["10"] = { bgc1 = "# | ["10"] = { bgc1 = "#bfbf00" }, | ||
}, | }, | ||
default = { bgc1 = "#cccccc" } | default = { bgc1 = "#cccccc" } | ||
2025年12月16日 (二) 17:22的版本
颜色配置维护指南
若需要添加新的路局与线路,请在本模块中编辑代码并保存。
格式:
新路局代号 = {
lines = {
["线路代号"] = { bgc1 = "颜色代码", color2 = "颜色代码" }, -- 需要color2时
["线路代号"] = { bgc1 = "颜色代码" }, -- 不需要color2时
},
default = { bgc1 = "默认颜色", color2 = "默认颜色" } -- color2可选
},
添加新线路
- 找到对应铁路局的配置
- 在
lines表中添加新线路 - 保存页面
修改颜色
- 找到对应的线路配置
- 修改
bgc1或color2的值 - 保存页面
local p = {}
-- 颜色配置表 - 只需编辑这个表
local colorConfig = {
-- ZTH轨道交通结社配置
R = {
lines = {
["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" },
["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" },
["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 = "#bfbf00" },
},
default = { bgc1 = "#cccccc" }
},
-- 全局默认配置(当路局未配置时使用)
default = {
bgc1 = "#cccccc",
color2 = "#cccccc"
}
}
-- 以下为主函数,仅添加线路时无需更改
function p.railBox(frame)
local args = frame.args
local bureau = 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 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 = {
bureau,
line,
station or "",
["color-system"] = "white",
["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