« Module:Charte » : différence entre les versions
Apparence
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 1 : | Ligne 1 : | ||
local p = {} | local p = {} | ||
local | local chartes = { | ||
titre = "# | -- Exemple de chartes personnalisées | ||
soustitre = "# | royaume = { | ||
titre = "#336699", | |||
defaut = "# | soustitre = "#99ccff", | ||
hr = "#6699cc" | |||
}, | |||
empire = { | |||
titre = "#993333", | |||
soustitre = "#ffcccc", | |||
hr = "#cc6666" | |||
}, | |||
-- Couleurs par défaut | |||
defaut = { | |||
titre = "#2e8b57", | |||
soustitre = "#b0c4de", | |||
hr = "#a2a9b1" | |||
} | |||
} | } | ||
function p.couleur(frame) | function p.couleur(frame) | ||
local args = frame.args | local args = frame.args | ||
local type = args["type"] or " | local charte = args["charte"] or "defaut" | ||
return | local type = args["type"] or "titre" | ||
if chartes[charte] and chartes[charte][type] then | |||
return chartes[charte][type] | |||
else | |||
return chartes["defaut"][type] or "#dddddd" | |||
end | |||
end | end | ||
return p | return p | ||
Version du 23 mai 2025 à 20:20
La documentation pour ce module peut être créée à Module:Charte/doc
local p = {}
local chartes = {
-- Exemple de chartes personnalisées
royaume = {
titre = "#336699",
soustitre = "#99ccff",
hr = "#6699cc"
},
empire = {
titre = "#993333",
soustitre = "#ffcccc",
hr = "#cc6666"
},
-- Couleurs par défaut
defaut = {
titre = "#2e8b57",
soustitre = "#b0c4de",
hr = "#a2a9b1"
}
}
function p.couleur(frame)
local args = frame.args
local charte = args["charte"] or "defaut"
local type = args["type"] or "titre"
if chartes[charte] and chartes[charte][type] then
return chartes[charte][type]
else
return chartes["defaut"][type] or "#dddddd"
end
end
return p