Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:ESColor: Difference between revisions

From Teriock
Content deleted Content added
// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 2: Line 2:


function p.c ( frame )
function p.c ( frame )
local life = (frame.args['life'] or frame.args['w']) and 1 or 0
local life = tonumber(frame.args['life']) == '1' and 1 or 0
local storm = (frame.args['storm'] or frame.args['b']) and 1 or 0
local storm = tonumber(frame.args['storm']) and 1 or 0
local necro = (frame.args['necro'] or frame.args['n']) and 1 or 0
local necro = tonumber(frame.args['necro']) and 1 or 0
local flame = (frame.args['flame'] or frame.args['r']) and 1 or 0
local flame = tonumber(frame.args['flame']) and 1 or 0
local nature = (frame.args['nature'] or frame.args['g']) and 1 or 0
local nature = tonumber(frame.args['nature']) and 1 or 0
life_color = '#f6d32d'
life_color = '#f6d32d'
storm_color = '#3584e4'
storm_color = '#3584e4'

Revision as of 07:13, 23 April 2025

Documentation for this module may be created at Module:ESColor/doc

local p = {}

function p.c ( frame )
    local life = tonumber(frame.args['life']) == '1' and 1 or 0
    local storm = tonumber(frame.args['storm']) and 1 or 0
    local necro = tonumber(frame.args['necro']) and 1 or 0
    local flame = tonumber(frame.args['flame']) and 1 or 0
    local nature = tonumber(frame.args['nature']) and 1 or 0
    life_color = '#f6d32d'
    storm_color = '#3584e4'
    necro_color = '#77767b'
    flame_color = '#f8a300'
    nature_color = '#33d17a'
    multi_color = '#9141ac'
    local color_counter = life + storm + necro + flame + nature
    if color_counter ~= 1 then
        return multi_color
    end
    if life == 1 then
        return life_color
    elseif storm == 1 then
        return storm_color
    elseif necro == 1 then
        return necro_color
    elseif flame == 1 then
        return flame_color
    elseif nature == 1 then
        return nature_color
    end
    return multi_color
end

return p