Module:DropsLineTest

From Roat Pkz
Revision as of 16:57, 5 May 2024 by Hefner (talk | contribs)
Jump to navigation Jump to search

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

-- Define a function to assign background color based on input numerical value
local function assignBackgroundColor(value)
    local color = ""
    -- Define your conditions and corresponding colors
    if value == 1 then
        color = "#afeeee" -- Light blue color
    elseif value == 1/25 then
        color = "#56e156" -- Light green color
    elseif value == 1/99.99 then
        color = "#ffed4c" -- Yellow color
    elseif value == 1/999.99 then
        color = "#ff863c" -- Orange color
    elseif value == 1/9999999 then
        color = "#ff6262" -- Red color
    else
        color = "#FFFFFF" -- Default color (white)
    end
    return color
end

-- Define a function to create a table row with colored cells
local function createColoredRow(data)
    local row = ""
    for _, value in ipairs(data) do
        local color = assignBackgroundColor(value)
        row = row .. "| style=\"background-color: " .. color .. ";\" | " .. value .. "\n"
    end
    return row
end