local SVK = Country:new{default = "background:#0079C1; color:#fff;"}
SVK:addTypesAsColor({"D", "R"}, "background:#006A4D; color:#fff;")
colors.SVK = SVK
end -- Slovakia
do -- South Africa
local ZAF = Country:new{default = "background:#006A4D; color:#FFF;"}
ZAF:addTypesAsColor({"M", "N"}, "background:#0079C1; color:#FFF;")
colors.ZAF = ZAF
end -- South Africa
do -- Spain
local ESP = Country:new{default = "background:#E8E8E8;"}
ESP:addTypesAsColor({"A", "AP", "AS"}, "background:#039; color:#fff;")
ESP:addTypesAsColor({"N"}, "background:#e41408; color:#fff;")
colors.ESP = ESP
end -- Spain
do -- Sri Lanka
local LKA = Country:new{default = "background:#006A4D; color:#fff;"}
LKA:addTypesAsColor({"E"}, "background:#0079C1; color:#fff;")
LKA:addTypesAsColor({"A"}, "background:#006A4D; color:#fff;")
colors.LKA = LKA
end -- Sri Lanka
do -- Switzerland
local CHE = Country:new{default = "background:#cedff2;"}
CHE:addTypesAsColor({"E"}, "background:#08842C; color:#fff;")
colors.CHE = CHE
end -- Switzerland
do -- Turkey
local TUR = Country:new{default = "background:#006A4D; color:#fff;"}
TUR:addTypesAsColor({"state", "D"}, "background:#003F87; color:#fff;")
colors.TUR = TUR
end -- Turkey
do -- United States
local USA = Country:new{default = "background:#006A4D; color:white;"}
USA:addTypesAsColor({"FFH", "FR", "NER", "Rec", "RE", "Park"}, "background:#704214; color:white;")
colors.USA = USA
end -- United States
end -- Multi-color countries  
do -- Built-in header types
colors["under construction"] = "background:#fc6;"
colors["const"] = "background:#fc6;"
colors["uc"] = "background:#fc6;"
colors["historic"] = "background:#704214; color:white;"
colors["historical"] = "background:#704214; color:white;"
colors["hist"] = "background:#704214; color:white;"
colors["scenic"] = "background:#704214; color:white;"
colors["decommissioned"] = "background:#AAA;"
colors["former"] = "background:#AAA;"
end -- Built-in header types
end  
function p._color(args)
return colors:color(args)
end  
function p.color
local pframe = :getParent
local config = .args -- the arguments passed BY the template, in the wikitext of the template itself
local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template  
local function emptyParam(param)
local empty = {[''] = true, ['¬'] = true}
if not(param) or empty[param] then
return nil
else
return param
end
end  
local state = config.state or args.state
state = emptyParam(state)
local province = config.province or args.province
province = emptyParam(province)
local type = config.type or args.type
local subtype = config.subtype or args.subtype or nil  
local headerType = args.header_type or config.header_type
headerType = emptyParam(headerType)
if headerType then
headerType = string.lower(headerType)
end  
local countryArg = config.country or args.country
countryArg = emptyParam(countryArg)
local country = countryArg
if not(country) then
if colors[headerType] then
country = ''
else
local stateParam = state or province
if not(stateParam) then
country = ''
else
local countryMask = require "Module:Infobox road/meta/mask/country"
country = countryMask._country(stateParam, countryArg)
end
end
end  
return p._color{country=country, state=state, province=province, type=type, subtype=subtype, headerType=headerType}
end  
return p