Module:Inventory slot: Difference between revisions

Add support for custom hex code colors
No edit summary
Tag: Reverted
(Add support for custom hex code colors)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
filename = 'Invicon $1',
filename = 'Invicon $1',
-- legacyFilename = 'Grid $1.png',
-- legacyFilename = 'Grid $1.png',
legacyFilename = '$1Invicon $2',
legacyFilename = '$1Invicon $2.png',
-- modLink = 'Mods/$1/$2',
-- modLink = 'Mods/$1/$2',
modLink = '$1:$2',
modLink = '$1:$2',
Line 193: Line 193:
plainTitle = title:gsub( '\\\\', '\' ):gsub( '\\&', '&' )
plainTitle = title:gsub( '\\\\', '\' ):gsub( '\\&', '&' )
local formatPattern = '&[0-9a-fk-or]'
local formatPatterns = {'&[0-9a-jl-qs-vyzr]', '&#%x%x%x%x%x%x', '&$%x%x%x'}
if plainTitle:match( formatPattern ) then
for _, formatPattern in ipairs( formatPatterns ) do
formattedTitle = title
if plainTitle:match( formatPattern ) then
plainTitle = plainTitle:gsub( formatPattern, '' )
formattedTitle = title
plainTitle = plainTitle:gsub( formatPattern, '' )
end
end
end