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

Module:MAKI GROUP数据

让世界变得更有趣吧!

概述

本模块用于存储和检索MAKI_GROUP系统的线路基础数据(颜色、简写、图标等)。它主要供其他模板(如线路标志、车站信息框)调用。

函数用法

color

获取线路的十六进制颜色代码。

  • 用法000000
  • 参数
    • 1 (线路名称):如“此方线”。
    • 2 (可选):输入 s 则返回带 # 前缀的颜色(如 #0072F9),否则仅返回 6 位代码。

short

获取线路的两位字母代码。

  • 用法线路名称
  • 返回:如 EA, EB 等。如果线路不存在,则返回输入的原名。

textcolor

获取在线路颜色背景上建议使用的文字颜色(用于保证对比度)。

  • 用法white
  • 返回:通常为 white

icon

获取线路图标的文件名。

  • 用法MAKI GROUP标志_线路名称.svg
  • 返回:模块定义的 .svg 文件名。若未定义,则按 MAKI GROUP数据_代码.svg 规则生成。

---

已定义线路数据

线路名称 颜色代码 示例 简写 图标文件 文字颜色
此方线 0072F9 EA EA EA_icon.svg white
博民线 329485 EB EB EB_icon.svg white
星绘线 52479B EC EC EC_icon.svg white
南横线 52B000 ED ED ED_icon.svg white
心夏线 BA9887 MK MK MK_icon.svg white
雪菲缓行线 99C5D6 MS MS MS_icon.svg white
冬青线 39C8BB MH MH MH_icon.svg white
远郊线 1B92CD ME ME ME_icon.svg white
南域线 007B61 IO IO IO_icon.svg white
西部环线 FFB00A IW IW IW_icon.svg white

默认处理

当输入的线路名称未在数据库中定义时:

  • 颜色:默认为 000000 (黑色)。
  • 代码:返回输入值本身。
  • 图标:尝试匹配 MAKI_GROUP标志_代码.svg

local p = {}

-- ============================================================
-- 配置区域:请只修改以下内容
-- color: 颜色代码 (不带#)
-- short: 线路两位英文代码
-- icon: 图标文件名
-- textcolor: 徽章内的文字颜色
-- ============================================================
local lines = {
    ['此方线']     = { color = '0072F9', short = 'EA', icon = 'EA_icon.svg', textcolor = 'white' },
    ['博民线']     = { color = '329485', short = 'EB', icon = 'EB_icon.svg', textcolor = 'white' },
    ['星绘线']     = { color = '52479B', short = 'EC', icon = 'EC_icon.svg', textcolor = 'white' },
    ['南横线']     = { color = '52B000', short = 'ED', icon = 'ED_icon.svg', textcolor = 'white' },
    ['心夏线']     = { color = 'BA9887', short = 'MK', icon = 'MK_icon.svg', textcolor = 'white' },
    ['雪菲缓行线'] = { color = '99C5D6', short = 'MS', icon = 'MS_icon.svg', textcolor = 'white' },
    ['冬青线']     = { color = '39C8BB', short = 'MH', icon = 'MH_icon.svg', textcolor = 'white' },
    ['远郊线']     = { color = '1B92CD', short = 'ME', icon = 'ME_icon.svg', textcolor = 'white' },
    ['南域线']     = { color = '007B61', short = 'IO', icon = 'IO_icon.svg', textcolor = 'white' },
    ['西部环线']   = { color = 'FFB00A', short = 'IW', icon = 'IW_icon.svg', textcolor = 'white' },
}
-- ============================================================
-- 配置区域结束
-- ============================================================

local function get_line_data(name)
    
    return lines[name] or { color = '000000', short = name, textcolor = 'white' }
end

function p.color(frame)
    local line = frame.args[1] or ""
    local mode = frame.args[2] or ""
    local data = get_line_data(line)
    return (mode == 's' and '#' or '') .. data.color
end

function p.short(frame)
    local line = frame.args[1] or ""
    local data = lines[line]
    if data and data.short then
        return data.short
    end
    return line 
end

function p.textcolor(frame)
    local line = frame.args[1] or ""
    local data = get_line_data(line)
    return data.textcolor or 'white'
end

function p.icon(frame)
    local line = frame.args[1] or ""
    local data = get_line_data(line)
    if data.icon then 
        return data.icon 
    end
    return 'MAKI GROUP标志_' .. (data.short or line) .. '.svg'
end

return p