模块:Rail line:修订间差异
来自RIA | Wiki
更多操作
无编辑摘要 |
无编辑摘要 |
||
| (未显示同一用户的8个中间版本) | |||
| 第3行: | 第3行: | ||
-- 颜色配置表 - 只需编辑这个表 | -- 颜色配置表 - 只需编辑这个表 | ||
local colorConfig = { | local colorConfig = { | ||
-- ZTH轨道交通结社配置 | |||
R = { | |||
lines = { | |||
["B"] = { bgc1 = "#b0c4de", color2 = "#b0c4de" }, | |||
["C"] = { bgc1 = "#ffd700", color2 = "#ffd700" }, | |||
["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" }, | ["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" }, | ||
["E"] = { bgc1 = "#3f6be0", color2 = "#3f6be0" }, | |||
["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" }, | ["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" }, | ||
["H"] = { bgc1 = "#ba55d3", color2 = "#ba55d3" }, | |||
["J"] = { bgc1 = "#c71585", color2 = "#c71585" }, | |||
["K"] = { bgc1 = "#8b4513", color2 = "#8b4513" }, | |||
["L"] = { bgc1 = "#ff69b4", color2 = "#ff69b4" }, | |||
["N"] = { bgc1 = "#ff0000", color2 = "#ff0000" }, | |||
["O"] = { bgc1 = "#800080", color2 = "#800080" }, | |||
["R"] = { bgc1 = "#cd5c5c", color2 = "#cd5c5c" }, | |||
["S"] = { bgc1 = "#7cfb00", color2 = "#7cfb00" }, | |||
["T"] = { bgc1 = "#0000cd", color2 = "#0000cd" }, | |||
["W"] = { bgc1 = "#006000", color2 = "#006000" }, | |||
["X"] = { bgc1 = "#ff7f50", color2 = "#ff7f50" }, | |||
["Y"] = { bgc1 = "#008b8b", color2 = "#008b8b" }, | |||
["Z"] = { bgc1 = "#191970", color2 = "#191970" }, | ["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" | |||
} | |||
} | } | ||
| 第42行: | 第83行: | ||
function p.railBox(frame) | 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 | end | ||
return p | return p | ||
2026年2月25日 (三) 15:28的最新版本
颜色配置维护指南
若需要添加新的路局与线路,请在本模块中编辑代码并保存。
格式:
新路局代号 = {
lines = {
["线路代号"] = { bgc1 = "颜色代码", color2 = "颜色代码" }, -- 需要color2时
["线路代号"] = { bgc1 = "颜色代码" }, -- 不需要color2时
},
default = { bgc1 = "默认颜色", color2 = "默认颜色" } -- color2可选
},
添加新线路
- 找到对应铁路局的配置
- 在
lines表中添加新线路 - 保存页面
修改颜色
- 找到对应的线路配置
- 修改
bgc1或color2的值 - 保存页面
local p = {}
-- 颜色配置表 - 只需编辑这个表
local colorConfig = {
-- ZTH轨道交通结社配置
R = {
lines = {
["B"] = { bgc1 = "#b0c4de", color2 = "#b0c4de" },
["C"] = { bgc1 = "#ffd700", color2 = "#ffd700" },
["D"] = { bgc1 = "#2bff9c", color2 = "#2bff9c" },
["E"] = { bgc1 = "#3f6be0", color2 = "#3f6be0" },
["F"] = { bgc1 = "#ffa500", color2 = "#ffa500" },
["H"] = { bgc1 = "#ba55d3", color2 = "#ba55d3" },
["J"] = { bgc1 = "#c71585", color2 = "#c71585" },
["K"] = { bgc1 = "#8b4513", color2 = "#8b4513" },
["L"] = { bgc1 = "#ff69b4", color2 = "#ff69b4" },
["N"] = { bgc1 = "#ff0000", color2 = "#ff0000" },
["O"] = { bgc1 = "#800080", color2 = "#800080" },
["R"] = { bgc1 = "#cd5c5c", color2 = "#cd5c5c" },
["S"] = { bgc1 = "#7cfb00", color2 = "#7cfb00" },
["T"] = { bgc1 = "#0000cd", color2 = "#0000cd" },
["W"] = { bgc1 = "#006000", color2 = "#006000" },
["X"] = { bgc1 = "#ff7f50", color2 = "#ff7f50" },
["Y"] = { bgc1 = "#008b8b", color2 = "#008b8b" },
["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