« Module:Color » : différence entre les versions
De Pikmin FR
fr>Fxfxfx0 m Suppression de la catégorie Category:Formatting templates et ajout de Catégorie:Modèles de mise en forme par un robot |
fr>Fxfxfx0 mAucun résumé des modifications |
||
Ligne 18 : | Ligne 18 : | ||
return p | return p | ||
Version du 16 juin 2024 à 18:19
Summary
Colors text the specified color.
{{Color|<The Text>|<The Color>|<ingame>}}
If ingame
is present, the named color is passed to {{Text color|<color>}} to show in-game color, instead of using HTML notation
To color links, see {{Color-link}}
Examples
Code | Result |
---|---|
{{color|Named Example|red}} |
000000 |
{{color|In-Game Example|Orange S2|ingame}} |
000000 |
{{color|Hex Example|#0055FF}} |
000000 |
local p = {}
local textColor = require('Module:TextColor')
-- Function to handle the color text
function p.main(frame)
local args = frame:getParent().args
local text = args[1] or ""
local color = args[2] or ""
local ingame = args[3] or ""
-- Check if the color is supposed to be an in-game color
if ingame == "ingame" then
color = 'rgb('.. textColor.getColor(color) ..')'
end
return '<span style="color:' .. color .. '">' .. text .. '</span>'
end
return p