Module:ColorSel: Difference between revisions

m
fix basic color mapping
(Created page with "-- This is core Color Selector function for `Template:ColorSel`. -- Do not use #invoke to invoke this module directly. local getArgs = require('Module:Arguments').getArgs local data = mw.loadData('Module:ColorSelData') local p = {} local function getRawMap(category) return (data.raw[category] and data.raw) end local function getGroupMap(category) return data.group[category] end local function getMap(category) local match_map -- Try to match raw map...")
 
m (fix basic color mapping)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs
local data = mw.loadData('Module:ColorSelData')
local data = mw.loadData('Module:ColorSel/data')
local p = {}
local p = {}


Line 49: Line 49:


     if match_map.type == "raw" then
     if match_map.type == "raw" then
         return ("#" .. (match_map.map[input] or match_map.map.default))
         return ("#" .. (match_map.map[category] or match_map.map.default))
     elseif match_map.type == "group" then
     elseif match_map.type == "group" then
         return ("#" .. recursiveFindKey(match_map.map, input))
         return ("#" .. recursiveFindKey(match_map.map, input))