16 390
contributi
(Adding a function for Pokémon types *** sovrascritto il testo esistente ***) |
(Refactoring of ChooseColor (damn recursive protection)) |
||
local tab = require('Modulo:Wikilib/tables') -- luacheck: no unused
local w = require('Modulo:Wikilib')
local multigen = require('Modulo:Wikilib/multigen')
local colorMod = mw.loadData('Modulo:Colore/data')
local colorschemeMod = mw.loadData('Modulo:Colorscheme/data')
local
local function _checkCol(col)
end
--
-- interface
p.forBg = function(frame)▼
p.forBgLua = function(bgColor)
local bgColor = frame.args[1]▼
local bgR = _checkCol(tonumber(bgColor:sub(1, 2), 16) / 255)
local bgG = _checkCol(tonumber(bgColor:sub(3, 4), 16) / 255)
return 'white-text'
end
end
▲p.forBg = function(frame)
return p.forBgLua(frame.args[1])
end
--
-- interface
p.forModBg = function(frame)▼
p.forModBgLua = function(color, shade)
▲ local shade = args[2] or 'normale'
local colorHex = colorMod[color][shade]
return p.
end
▲p.forModBg = function(frame)
▲-- given two background hex colors, return the most appropriate text color
-- calculated on the midpoint▼
p.forGradBg = function(frame)▼
local args = w.trimAll(frame.args)
end
-- Given two background hex colors, return the most appropriate text color
▲-- calculated on the midpoint
p.forGradBgLua = function(c1, c2)
local c1R = tonumber(c1:sub(1, 2), 16)
local c1G = tonumber(c1:sub(3, 4), 16)
local midpointHex = string.format('%x%x%x', R, G, B)
return p.
end
-- Given two background hex colors, return the most appropriate text color
-- calculated on the midpoint
▲-- given two background module colors, return the most appropriate text color
p.
local args = w.trimAll(frame.args)
return p.forGradBgLua(args[1], args[2])
end
-- Given two background module colors, return the most appropriate text color.
if col1 == col2 then▼
-- Lua interface
return p.forModBg{args={col1}}▼
p.forModGradBgLua = function(col1, col2)
▲ if (not col2) or (col1 == col2) then
else
return p.
end
end
-- Given two background module colors, return the most appropriate text color
return p.forModGradBgLua(args[1], args[2] or args[1])
end
-- Given two background colorscheme names, return the most appropriate text
-- color
p.forModCsGradBg = function(frame)
local args = w.trimAll(frame.args)
local hex2 = colorschemeMod[col]['dark']
return p.
end
local gen = args.gen or ''
local type1 =
local type2 =
return p.
end
|