×
Create a new article
Write your page title here:
We currently have 70,374 articles on Fallout Wiki. Type your article name above or click on one of the titles below and start writing!



Fallout Wiki
70,374Articles
Fallout Prime Banner.jpg

This is the documentation page for Module:Icons

Icon Public Workshop.pngThis page contains usage information for Module:Icons.

Change icons here Module:Icons/data.

A library of functions for displaying icons on pages or within other templates. For best performance, a chain of icons (sit in a row with nothing between) should be done with a single call.

Functions

This module relies on the exists() and trim() contained within Module:Util. All function calls from this module are prefixed with util e.g. util.exists().

_generate()

This function is internal only and the main workhorse for p.Icons() and p.innerIcon(). This function builds the function list. The first task is determining the size of the icons.

    if util.exists(iconSetting)  then 
    	iconSetting = util.trim(iconSetting)
        if util.exists(iconSize[iconSetting]) then
            iconSetting = iconSize[iconSetting]
        end
    else
        iconSetting = iconSize["medium"]
    end
    -- This is for calls from other Lua modules as the above will result in nil
    if util.exists(iconSetting) == false then
    	if util.exists(iconSize) then
			iconSetting = iconSize
		else
			iconSetting = iconSize["medium"]
		end
    end

In wikitext mark up the rough equivalent would be:

{{#ifeq:{{{iconSetting}}}|medium|{{#switch:{{{iconSetting}}}|a = x14px |b = 16px| c= 20px|...|#default = {{{iconSize|x14px}}}}}}}

The next step is to break the comma separated lists into a table:

    if util.exists(iconLinks) then
        iconLinks = mw.text.split(iconLinks, ",")
    end
        
    if util.exists(tipOverride) then
        tipOverride = mw.text.split(tipOverride, ",")
    end
    
    if util.exists(iconClass)then
    	iconClass = "|class=" .. tostring(iconClass);
    else
    	iconClass = ""
    end

This would be the equivalent of using multiple {{#explode:}} functions and variables to store each item as its own.

Once the data has been pre-processed a loop is used to run through each item in the list to generate the icon collection:

    for k, v in ipairs(iconList) do
        newIcon = iconData[util.trim(v)]
        if util.exists(newIcon) then
            currentIcon = newIcon.icon
            if util.exists(tipOverride, k) then
                currentTip = tipOverride[k]
            else
                if util.exists(iconLinks, k) then
                    currentTip = iconLinks[k]
                else
                    currentTip = newIcon.tip
                end
            end
        else
            currentIcon = "Icon question.png"
            currentTip = "Unrecognized icon name"
            result = result .. "[[Category:Modules with invalid parameters]]"
        end
        
        --Create wikitext icon
		dataLine = '[[File:' .. currentIcon .. '|' .. iconSetting
        if util.exists(iconLinks, k) then
            dataLine = dataLine .. '|link=' .. iconLinks[k]
        else
            dataLine = dataLine .. '|link='
        end
        if currentTip ~= nil then
            dataLine = dataLine .. '|' .. currentTip
        end

        dataLine = dataLine .. iconClass .. ']]'

		createTip = mw.html.create('span')
        	createTip:addClass( 'va-icon' )
        	:attr('title', currentTip)
        	:wikitext(dataLine)
        result = result .. tostring(createTip)
        
        if k < table.getn(iconList) then
        	result = result .. " "
        end
    end

Line 2 checks the data list at Module:Icons/data for the data relating to the icon short code and returns a result or nil (does not exist) Depending on if a result was found the code continues, if there is no match a dummy icon is supplied at lines 14/15 and a maintenance category added at line 16.

If a match is found, the next task is to check if the tooltip is being overwritten, if it isn't being overwrite, it will then check if an page alternative link has been supplied, otherwise fall back to the default tooltip.

The wikitext equivalent would be

{{{tipOverride|{{{iconLinks|default}}}}}}

Now the correct icon, tooltip and link have been obtained, lines 21-31 build the image file in the format [[File:<icon>|<size>|link=<link>|<tooltip>|class=<class>]].

Lines 33-37 create the <span /> which contains the icon and inserts the icon inside. When rendered this will appear as <span class="va-icon" title="<tooltip>">icon</span>.

Finally lines 39-41 check if the item being created is the last in the list to be created. If not it will add a space at the end of the string so there is space between the icons on the page once completed.

Invocation parameters

The invocation parameters are passed through from p.Icons(frame) or p.innerIcon(iconList, iconSetting, iconLinks, tipOverride, iconClass, iconSize). The variables align between these three functions and the below should be taken as an explanation for all three.

Label Parameter Variable Description Required Example
Icons 1 iconList A string list of icon short code(s) passed through to the module. For multiple codes being passed these should be split by a comma (,). Yes fo76,ww
Icon Size 2 iconSetting The image size to be passed to all icons in the list. A custom size can be set (e.g. x26px) or one of the standard sizes can be applied:
  • small = x10px
  • medium = x14px
  • normal = x14px
  • big = x20px

To ensure all icons are consistent in size, it is recommended to control on the height (e.g. x14px) rather than the width (e.g. 14px)

No - Defaults are built in
Link 3 iconLinks The page(s) the icon(s) links to. For multiple pages, article names are split with a comma (,) No Fallout 76,Wild Wasteland
Tooltip 4 tipOverride The tooltip(s) shown when hovering over the icon(s), for multiple icons, the tooltips can be split with a comma (') No - Defaults are built in Fire, EMP
CSS Class 4 iconClass CSS classes to be applied to the icons. If this is set it will apply to all icons in the group. Classes are written without the class= component. No va-icon va-icon-blue

p.Icons() and p.innerIcon()

These two functions are pass through functions to _generate(). Before passing through the list of icons supplied is split.

The differences between the functions is where they should be used and that p.innerIcon() doesn't pass through a table of icon sizes, just a predetermined size and can only be called from other lua modules. p.Icons() is for all other namespaces and cannot be called from another module.

Invocation parameters

Due to the close nature of these two functions and _generate() the invocation parameters are the same as listed above.

p.platforms()

p.platforms() uses the same data set as the other functions, but only returns results for icons that have been marked as being a platform in the data set. In addition to this, it also uses Semantic Mediawiki so the data returned can be queried in Special:Ask.

Once the function has confirmed the icon in the list is a valid platform, it will create a hidden <span /> holding the semantic tag advising of the platform assigned from the default tooltip [[Has platform::<platform>]]. The code then largely follows that of _generate() to create the icon, with a blank link attribute. The two spans are then joined together before checking for the next platform.

If no platforms are found the code will return <sup>[Platforms needed]</sup>[[Category:Platforms needed]].

Invocation parameters

The only parameter taken by this function is the iconList parameter, holding the string of short codes.

p.documentation()

p.documentation() is self generating documentation to display the icon produced by each short code. It first takes all the datasets available and sorts them into alphabetical order and creates a table header allowing for 3 icons in a row. For each short code it will put the short code in the first, third or fifth column and the icon in the second, fourth or sixth column based on where in the sorted dataset it resides.

Due to the ever expanding icon list, this function does run the risk of becoming oversized with time. If the character size is exceeded it may need splitting into two functions.

Invocation parameters

As a self contained function, there are not parameters that can be passed through.

Available icons

prefix Icon prefix Icon prefix Icon
FNV Gametitle-FNV.png FNVCS Gametitle-FNV CS.png FNVDM Gametitle-FNV DM.png
FNVGRA Gametitle-FNV GRA.png FNVHH Gametitle-FNV HH.png FNVLR Gametitle-FNV LR.png
FNVOWB Gametitle-FNV OWB.png FO Gametitle-FO1.png FO1 Gametitle-FO1.png
FO1ST FO1st.png FO2 Gametitle-FO2.png FO3 Gametitle-FO3.png
FO3BS Gametitle-FO3 BS.png FO3MZ Gametitle-FO3 MZ.png FO3OA Gametitle-FO3 OA.png
FO3PL Gametitle-FO3 PL.png FO3TP Gametitle-FO3 TP.png FO4 Gametitle-FO4.png
FO4AUT Gametitle-FO4 AUT.png FO4CC Gametitle-FO4 CC.png FO4CW Gametitle-FO4 CW.png
FO4FH Gametitle-FO4 FH.png FO4NW Gametitle-FO4 NW.png FO4VR Gametitle-FO4.png
FO4VW Gametitle-FO4 VW.png FO4WW Gametitle-FO4 WW.png FO76 Gametitle-FO76.png
FO76FW Gametitle-FO76 FW.png FO76IB Gametitle-FO76 TS.png FO76LL Gametitle-FO76 Locked n Loaded.png
FO76LR Gametitle-FO76 LR.png FO76MI Gametitle-FO76.png FO76NM Gametitle-FO76 NM.png
FO76NW Gametitle-FO76 NW.png FO76NWT Gametitle-FO76 NWOT.png FO76OW Gametitle-FO76 One Wasteland.png
FO76RD Gametitle-FO76.png FO76SD Gametitle-FO76 Steel Dawn.png FO76SR Gametitle-FO76 Steel Reign.png
FO76TM Gametitle-FO76 TYM.png FO76TP Gametitle-FO76 TP.png FO76WA Gametitle-FO76 WA.png
FO76WL Gametitle FO76WL.png FOBOS Gametitle-FOBOS.png FOBOS2 Infobox.webp
FOS Gametitle-FOS.png FOSO Gametitle-FOSO.png FOT Gametitle-FOT.png
FOT2 Infobox.webp FOW Infobox.webp FOWW FOWW Logo.png
FOX Infobox.webp FPB Gametitle-FPB.png FWW Gametitle-FWW.png
FWWRPG FOWW RPG Logo.png ability Icon ability.png ac Icon shield bronze.png
acid Icon acid.png action Icon action.png agi FO76 A.png
agi dark FO76 A.png alcohol FO76 ui casual team.png ammo UI C Icon ChiLun 01.png
ammo2 UI C Icon ChiLun 01.png android Icon android.png aotl AttackOfTheLobotomitesLogocut.png
ap Icon ap.png apple Icon appleios.png ar Gametitle-AR.png
armorwb FO76 iconwheel armor.png atom FO76 Atom Currency 2.webp attack Icon attack.png
axed Fire axe icon color.png blade Icon blade.png bleed Icon bleed.png
blunt Icon blunt.png bonezone Upper skull.png bonus effect Icon bonus effect.png
boss FoS Boss.png brain Brain icon.png bronze Bronze.png
bullion Score currency bullion l.webp camp FO76 ui extra team.png caps Caps.png
caravan Icon cards.png cards Icon cards.png chance FO76 ui roleplay team.png
chance fo76 FO76 ui roleplay team.png check FO76 icon xpd yellowcheck.png check1 FO76 icon xpd yellowcheck.png
checkbrown FO76 icon xpd yellowcheck.png chems FO76 Chems Icon.svg chemst Fo4 Chem Work Icon.png
chr FO76 C.png chr dark FO76 C.png colmod Affiliate Collective Modding logo.png
companion UI C Icon Community.png confidence Icon confidence.png cookst Fallout 76 Food Icon.svg
craft Icon crafting.png credit Credits icon.png crit Icon critical damage.png
crit effect Icon crit effect.png cross FO76 icon xpd redx.png crosshair Icon attack.png
cryo Icon cryo.png csep CSEP Banner Logo.png cut Icon cut.png
d20 Infobox.webp dailyops FO76 ui dailyops team.png damage Icon damage.png
dap Icon dap.png dead FO76 ui workshopraid team.png default Brain icon.png
defense Icon shield silver.png detect Icon eye.png detection Icon eye.png
dial Icon mentioned.png dialogue Icon mentioned.png disease Icon disease.png
dislike VT Dislike.png dislike2 Vaultboymad.webp distance Icon level.png
diz Diz Icon.png doctor Icon doctor.png dos DOS Icon.svg
dps Icon dps.png dr Icon shield silver.png drink FO76 Drink Icon.svg
dt Icon shield gold.png dur Icon limitedtime.png effect Icon effect.png
electrical Icon electrical.png emp Icon EMP.png end FO76 E.png
end dark FO76 E.png energy Icon energy.png enslave Icon cage.png
essential Icon essential.png event FO76 icon map event.png eventpublic FO76 icon map public event.png
expedition FO76 publicteam xpd.png expeditions FO76 publicteam xpd.png experience Icon XP.png
explmill UI YS C Icon ShiGongDui.png explosion Icon explosion.png expo FO76 publicteam xpd.png
expos FO76 publicteam xpd.png eye Icon eye.png fb Fallout Bible logo.png
fbg Fallout The Board Game Icon.png fbgagenda FBG Agenda icon.svg fbgaggressive FBG Aggressive icon.svg
fbgagility FBG A icon.svg fbgapparel FBG Apparel icon.svg fbgarmor FBG Armor icon.svg
fbgasset FBG Asset icon.svg fbgcharisma FBG C icon.svg fbgcompanion FBG Companion icon.svg
fbgcritter FBG Critter icon.svg fbgdangerous FBG Dangerous icon.svg fbgdeadly FBG Deadly icon.svg
fbgdieablhits FBG Die ABL Hits.png fbgendurance FBG E icon.svg fbgfreedom FBG Freedom icon.svg
fbghit FBG Hit icon.svg fbghuman FBG Human icon.svg fbgintelligence FBG I icon.svg
fbgloot FBG Loot icon.svg fbgluck FBG L icon.svg fbgmonster FBG Monster icon.svg
fbgnc Gametitle-FBGNC.png fbgperception FBG P icon.svg fbgquest FBG Quest objective.svg
fbgradiation FBG Radiation icon.svg fbgranged FBG Ranged icon.svg fbgretreat FBG Retreat icon.svg
fbgrobot FBG Robot icon.svg fbgsecurity FBG Defender icon.svg fbgsettlement FBG Settlement icon.svg
fbgstrength FBG S icon.svg fbgsupermutant FBG Super Mutant icon.svg fbgvault109 FBG Vault 109 icon.svg
fbgvault84 FBG Vault 84 icon.svg fbgwasteland FBG Wasteland icon.svg fbgweapon FBG Weapon icon.svg
fbgww Fallout The Board Game Icon.png film Wiki.png fire Icon fire.png
firerate UI C Icon ChiLun 01.png fist Icon fist.png fnv Gametitle-FNV.png
fnvcs Gametitle-FNV CS.png fnvdm Gametitle-FNV DM.png fnvgra Gametitle-FNV GRA.png
fnvhh Gametitle-FNV HH.png fnvlr Gametitle-FNV LR.png fnvowb Gametitle-FNV OWB.png
fnvww Icon wildwasteland.png fo Gametitle-FO1.png fo1 Gametitle-FO1.png
fo1st FO1st.png fo2 Gametitle-FO2.png fo3 Gametitle-FO3.png
fo3bs Gametitle-FO3 BS.png fo3mz Gametitle-FO3 MZ.png fo3oa Gametitle-FO3 OA.png
fo3pl Gametitle-FO3 PL.png fo3tp Gametitle-FO3 TP.png fo4 Gametitle-FO4.png
fo4aut Gametitle-FO4 AUT.png fo4cc Gametitle-FO4 CC.png fo4chain01 Icon Fo4 chain01.png
fo4chain02 Icon Fo4 chain01.png fo4chain03 Icon Fo4 chain01.png fo4cw Gametitle-FO4 CW.png
fo4fh Gametitle-FO4 FH.png fo4gencard Icon Fo4 gen keycard.png fo4holo Icon Fo4 holotape.png
fo4key01 Icon Fo4 chain01.png fo4key02 Icon Fo4 chain01.png fo4key03 Icon Fo4 chain01.png
fo4note FSO UI C Icon Renwu.png fo4nw Gametitle-FO4 NW.png fo4vaultid Icon Fo4 vaultid.png
fo4vr Gametitle-FO4.png fo4vw Gametitle-FO4 VW.png fo4ww Gametitle-FO4 WW.png
fo76 Gametitle-FO76.png fo76acap Infobox.webp fo76acbp FO76AC Icon.png
fo76fw Gametitle-FO76 FW.png fo76ib Gametitle-FO76 TS.png fo76ll Gametitle-FO76 Locked n Loaded.png
fo76lr Gametitle-FO76 LR.png fo76mi Gametitle-FO76.png fo76nm Gametitle-FO76 NM.png
fo76nw Gametitle-FO76 NW.png fo76nwt Gametitle-FO76 NWOT.png fo76obm FO76OBM.png
fo76ow Gametitle-FO76 One Wasteland.png fo76rd Gametitle-FO76.png fo76sd Gametitle-FO76 Steel Dawn.png
fo76sr Gametitle-FO76 Steel Reign.png fo76tm Gametitle-FO76 TYM.png fo76tp Gametitle-FO76 TP.png
fo76wa Gametitle-FO76 WA.png fo76wl Gametitle FO76WL.png fobos Gametitle-FOBOS.png
fobos2 Infobox.webp folon Fallout London Logo.webp food Fallout 76 Food Icon.svg
foodpr UI YS C Icon ShiGongDui.png fos Gametitle-FOS.png foso Gametitle-FOSO.png
fot Gametitle-FOT.png fot2 Infobox.webp fow Infobox.webp
foww FOWW Logo.png fox Infobox.webp fpb Gametitle-FPB.png
free ATX FREE.png frost Icon effect.png fww FOWW Logo.png
fwwrpg FOWW RPG Logo.png game FO76 ui roleplay team.png gamerscore Gamerscore.svg
gas Icon gas.png gold Gold.png grenade FO76 iconwheel grenade.png
group Icon group.png gun Icon gun.png hate VT Hate.png
hate2 Chaotic Evil.webp healing UI C Icon Dian 279627 12.png healing rate UI C Icon Dian 279627 12.png
health UI C Icon Dian 279627 12.png heart UI C Icon Dian 279627 12.png hp UI C Icon Dian 279627 12.png
image FO76 Quest Camera.png info FO76 ui roleplay team.png int FO76 I.png
int dark FO76 I.png ios Icon appleios.png jes Infobox.webp
jury FO76 vaultboy licensedplumber 01.png laser Icon laser.png lck FO76 L.png
lck dark FO76 L.png legacy Icon limitedtime.png legendary Icon legendary.png
legendperk FO76 Perk coin.webp level Icon level.png lgbtq Atx playericon prideprogress.webp
like VT Like.png like2 UI Icon RenKou.png limited Icon limitedtime.png
limitedtime Icon limitedtime.png loc FO76 ui exploration team.png location FO76 ui exploration team.png
love UI C Icon EXPCoin.png love2 Icon interactions romance.webp lunchbox FO76 Lunchbox Icon.svg
mac Icon mac.png macclassic Icon mac.png mag Icon mag.png
melee Icon melee.png mentioned Icon mentioned.png merchant FO76 ui trading team.png
mine FO76 iconwheel minefrag.png mod Icon plus.png mpbs Alien Archivist.png
mpcmp Alien Archivist.png mpdf Alien Archivist.png mpdm Alien Archivist.png
mpfnv Alien Archivist.png mpfo3 Alien Archivist.png mphh Alien Archivist.png
mpmt Alien Archivist.png mpmz Alien Archivist.png mpoa Alien Archivist.png
mpowb Alien Archivist.png mppl Alien Archivist.png mpreq Alien Archivist.png
mptp Alien Archivist.png mutation FO76 Mutation Icon.svg mutation dark FO76 vaultboy dna.png
neutral Icon neutral.png neutralface VT Neutral.png neutralface2 UI C Icon BiaoQing1.png
new ATX NEW.png no FO76 icon xpd redx.png note UI C Icon PveBuff C ShengCunZhiShi.png
notrade Icon NoTrade.png nukamix Icon Nuka-mixer station.png nw FO76NW Vault 51 icon.png
optional Icon optional.png pail Icon FO76 mole miner pail.png parmorst Fo4 Power Work Icon.png
pbgame Fo4 Pip-Boy game.png pc Icon pc.png per FO76 P.png
per dark FO76 P.png percent FO76 ui roleplay team.png physical Icon attack.png
pistol FO76 iconwheel pistol.png plan FO76 Plan bostechdocs.webp plasma Icon plasma.png
platinum Plat.png plus Icon plus.png poison Icon poison.png
poison2 Poison Icon.png possum FO76 Possum badge blue.png possum dark FO76 Possum badge.png
present FO76 Present Icon.png ps2 PS2 Logo.png ps3 Icon ps3.png
ps4 Icon ps4.png ps5 PlayStation 5 logo.png publicworkshop Icon Public Workshop.png
pve FO76 ui casual team.png pvp FO76 ui workshopraid team.png quest FO76 ui icon quest.png
question Icon question.png radiation Icon radiation.png random FO76 ui roleplay team.png
range Icon level.png rarity Icon rarity.png ratio Icon ratio.png
removed Fire axe icon color.png repair FO76 ui workshop team.png repeat Icon repeat.png
required Icon required.png rifle Icon rifle.png robotwb UIAni CF3 ExploreRobot2.png
rwot NW.png score FO76 scoresprite seasons.png scout FO76 Pioneer Scouts.png
scrip FO76 Scrip.png season FO76 scoresprite seasons.png seasonal FO76 Quest Old Man Winter.png
semi Icon semi-required.png semi-required Icon semi-required.png sequence Icon sequence.png
shieldbronze Icon shield bronze.png shieldgold Icon shield gold.png shieldsilver Icon shield silver.png
shotgun Icon shotgun.png sic Icon sic.png silver Silver.png
smg Icon smg.png sound Icon sound.png spawn FO76 ui roleplay team.png
spooky FO76 candyBowl MapIcon.png spread Icon spread.png stamp FO76 collections stamps01.webp
star Icon legendary.png stimpak FO76 Stimpak Icon.svg str FO76 S.png
str dark FO76 S.png stucomm VT Like.png studata VT Dislike.png
stuedit Schmault Tec Editing Icon.png stuoutside Icon Outside the Vault.png survival FO76 icon roadmap survival.png
tadpole FO76 Tadpole badge blue.png tadpole dark FO76 Tadpole badge.png tea UI C Icon KongXianCaiBan.png
temp FO76 icon xpd yellowcheck.png test Icon test.png text FSO UI C Icon Renwu.png
ticket Tickets Icon.webp tickets Tickets Icon.webp ttw TTW icon.png
unarmed Icon unarmed.png unused Icon unused.png upcoming Mbox upcoming.png
v76 FO76 Vault 76 icon.png vaultraid Vault Raids.png vaulttec Icon vaulttec.png
vb Van Buren Fallout 3 Logo.png vt Icon vaulttec.png weapwb UI YS C Icon ShiGongDui.png
weight FO76 icon weight.png wiki Infobox.webp wild wasteland Icon wildwasteland.png
windows Icon windows.png ww Icon wildwasteland.png xbox Xbox OG Icon.svg
xbox360 Icon xbox360.png xboxone Icon xboxone.png xboxseries Xbox Series X logo.png
xp Icon XP.png xpd FO76 publicteam xpd.png yes FO76 icon xpd yellowcheck.png

In addition, all abbreviations supported by {{Abb}} can be used to produce an icon for the corresponding game.