Module:WeatherBox
ⵜⵉⴼⵔⴰⵙ
local WeatherBox = {}
-- Function to determine temperature color
function WeatherBox.getTempColor(temp)
temp = tonumber(temp) or 0 -- Convert to number or default to 0
if temp <= 0 then
return "#add8e6" -- Light blue for freezing temperatures
elseif temp <= 20 then
return "#ffd700" -- Yellow for moderate temperatures
else
return "#ff4500" -- Red for hot temperatures
end
end
-- Function to determine precipitation color
function WeatherBox.getPrecipColor(precip)
precip = tonumber(precip) or 0 -- Convert to number or default to 0
if precip <= 10 then
return "#e0ffff" -- Light cyan for very low precipitation
elseif precip <= 50 then
return "#90ee90" -- Light green for moderate precipitation
else
return "#4682b4" -- Steel blue for high precipitation
end
end
return WeatherBox