local p = {}  
Country = {}  
function Country:new(obj)
obj = obj or {}
setmetatable(obj, self)
self.__index = self
return obj
end  
function Country:color(args)
local type = args.type
return self[type] or self.default
end  
function Country:addTypesAsColor(types, color)
for i,type in pairs(types) do
self[type] = color
end
end  
local colors = {}
do
function colors:color(args)
local headerType = args.headerType
local countryArg = args.country
local headerTypeColor = self[headerType]
if headerTypeColor then return headerTypeColor end
local success, country = pcall(self.country, self, countryArg)
if not(success) then
return 'background:#cedff2;'
else
return country:color(args)
end
end
function colors:country(name)
local color = self[name]
if color then return color end
if name == 'CAN' or name == 'GBR' then
local module = require(string.format("Module:Infobox road/color/%s", name))
return module.colors
else
error("Country not included", 0)
end
end  
do -- Single-color countries
colors.BEL = Country:new{default = "background:#0071B3; color:#fff;"}
colors.BGD = Country:new{default = "background:#2C6700; color:white;"}
colors.CHN = Country:new{default = "background:#006A4D; color:white;"}
colors.ECU = Country:new{default = "background:#006A4D; color:#fff;"}
colors.EST = Country:new{default = "background:#0079C1; color:white;"}
colors.EUR = Country:new{default = "background:#08842C; color:#fff;"}
colors.JOR = Country:new{default = "background:#0079C1; color:white;"}
colors.HKG = Country:new{default = "background:#006A4D; color:#fff;"}
colors.ISL = Country:new{default = "background:#FFD200; : solid #000;"}
colors.MEX = Country:new{default = "background:#006A4D; color:white;"}
colors.NZL = Country:new{default = "background:#006A4D; color:#fff;"}
colors.UKR = Country:new{default = "background:#003F87; color:white;"}
colors.URY = Country:new{default = "background:#006A4D; color:white;"}
colors.VNM = Country:new{default = "background:#003399; color:white;"}
end -- Single-color countries  
do -- Multi-color countries
do -- Albania
local ALB = Country:new{default = "background:#00408B; color:#fff;"}
ALB:addTypesAsColor({"A"}, "background:#08842C; color:#fff;")
colors.ALB = ALB
end -- Albania
do -- Asian Highway Network
local ASIA = Country:new{default = "background:#fff; : solid #000;"}
ASIA:addTypesAsColor({"AH"}, "background:#1e2c76; color:white;")
colors.ASIA = ASIA
end -- Asian Highway Network
do -- Australia
local AUS = Country:new{default = "background:#3A7119; color:#FFE133;"}
AUS:addTypesAsColor({"freeway"}, "background:#D2E2F9;")
AUS:addTypesAsColor({"highway", "city highway"}, "background:#E9F9D2;")
AUS:addTypesAsColor({"road", "rural road"}, "background:#FFFFE0;")
AUS:addTypesAsColor({"street"}, "background:#F9E2D2;")
AUS:addTypesAsColor({"track"}, "background:#fee8ab;")
colors.AUS = AUS
end -- Australia
do -- Austria
local AUT = Country:new{default = "background:#fff; : solid #000;"}
AUT:addTypesAsColor({"A", "S", "B"}, "background:#276FB7; color:#fff;")
colors.AUT = AUT
end -- Austria
do -- Bosnia and Herzegovina
local BIH = Country:new{default = "background:#0B8F4B; color:white;"}
BIH:addTypesAsColor({"M", "B"}, "background:#0066CC; color:white;")
BIH:addTypesAsColor({"R"}, "background:#FFCC33; : solid #000;")
colors.BIH = BIH
end -- Bulgaria
do -- Bulgaria
local BGR = Country:new{default = "background:#003F87; color:white;"}
BGR:addTypesAsColor({"A"}, "background:#006A4D; color:white;")
colors.BGR = BGR
end -- Bulgaria
do -- Croatia
local HRV = Country:new{default = "background:#cedff2;"}
HRV:addTypesAsColor({"E", "A"}, "background:#08842C; color:#fff;")
HRV:addTypesAsColor({"D"}, "background:#0066CC; color:#fff;")
HRV:addTypesAsColor({"Z"}, "background:#FFCC33; color:black;")
colors.HRV = HRV
end -- Croatia
do -- Cyprus
local CYP = Country:new{default = "background:#003F87; color:#FFC000;"}
CYP:addTypesAsColor({"A"}, "background:#005024; color:#FFC000;")
colors.CYP = CYP
end -- Cyprus
do -- Czech Republic
local CZE = Country:new{default = "background:#003F87; color:white;"}
CZE:addTypesAsColor({"D", "R"}, "background:#006A4D; color:white;")
colors.CZE = CZE
end -- Czech Republic
do -- Denmark
local DNK = Country:new{default = "background:#039; color:#fff;"}
DNK:addTypesAsColor({"E", "M"}, "background:#006A4D; color:#fff;")
DNK:addTypesAsColor({"S"}, "background:#fff; : solid #af1e2d; color:#af1e2d;")
colors.DNK = DNK
end -- Denmark
do -- France
local FRA = Country:new{default = "background:#fff; : solid #000;"}
FRA:addTypesAsColor({"A"}, "background:#0079C1; color:#fff;")
FRA:addTypesAsColor({"N"}, "background:#006A4D; color:#fff;")
colors.FRA = FRA
colors.MTQ = FRA
end -- France
do -- Georgia
local GEO = Country:new{default = "background:#cedff2;"}
GEO:addTypesAsColor({"A", "International"}, "background:#039; color:#fff;")
colors.GEO = GEO
end -- Georgia
do -- Germany
local DEU = Country:new{default = "background:#cedff2;"}
DEU:addTypesAsColor({"A", "Autobahn"}, "background:#039; color:#fff;")
DEU:addTypesAsColor({"B", "Bundesstraße", "Bundesstrasse"}, "background:#FC3; color:black")
DEU:addTypesAsColor({"E"}, "background:#08842C; color:#fff;")
colors.DEU = DEU
end -- Germany
do -- Ghana
local GHA = Country:new{default = "background:#006A4D; color:#FFF;"}
GHA:addTypesAsColor({"N"}, "background:#0079C1; color:#FFF;")
colors.GHA = GHA
end -- Ghana
do -- Greece
local GRC = Country:new{default = "background:#0079C1; color:#FFF;"}
GRC:addTypesAsColor({"A"}, "background:#006A4D; color:#FFF;")
colors.GRC = GRC
end -- Greece
do -- Hungary
local HUN = Country:new{default = "background:#006A4D; color:#fff;"}
HUN:addTypesAsColor({"M"}, "background:#0079C1; color:#fff;")
colors.HUN = HUN
end -- Hungary
do -- Iran
local IRN = Country:new{default = "background:#cedff2;"}
IRN:addTypesAsColor({"freeway"}, "background:#06c; color:#fff;")
IRN:addTypesAsColor({"expressway"}, "background:#22B14C; color:#fff;")
IRN:addTypesAsColor({"road"}, "background:#22B14C; color:#fff;")
IRN:addTypesAsColor({"boulevard"}, "background:#fff; color:#000;")
IRN:addTypesAsColor({"street"}, "background:#fff; color:#000;")
colors.IRN = IRN
end -- Iran
do -- Republic of Ireland
local IRL = Country:new{default = "background:#cedff2;"}
IRL:addTypesAsColor({"M"}, "background:#0079C1; color:#fff;")
IRL:addTypesAsColor({"N"}, "background:#00703C; color:#FFD200;")
IRL:addTypesAsColor({"R"}, "background:#fff; : solid #000;")
colors.IRL = IRL
end -- Republic of Ireland
do -- Italy
local ITA = Country:new{default = "background:#cedff2;"}
ITA:addTypesAsColor({"A"}, "background:#08842C; color:#fff;")
ITA:addTypesAsColor({"SS"}, "background:#003F87; color:#fff;")
ITA:addTypesAsColor({"E"}, "background:#08842C; color:#fff;")
colors.ITA = ITA
end -- Italy
do -- Kosovo
local KOS = Country:new{default = "background:#0066cc; color:#fff;"}
KOS:addTypesAsColor({"R"}, "background:#009933; color:#fff;")
KOS:addTypesAsColor({"E"}, "background:#08842C; color:#fff;")
colors.KOS = KOS
end -- Netherlands
do -- Netherlands
local NLD = Country:new{default = "background:#0079C1; color:#fff;"}
NLD:addTypesAsColor({"E"}, "background:#08842C; color:#fff;")
colors.NLD = NLD
end -- Netherlands
do -- Malaysia
local MYS = Country:new{default = "background:#0079C1; color:#fff;"}
MYS:addTypesAsColor({"E"}, "background:#006A4D; color:#fff;")
colors.MYS = MYS
end -- Malaysia
do -- Pakistan
local PAK = Country:new{default = "background:#0066cc; color:#fff;"}
PAK:addTypesAsColor({"M"}, "background:#22B14C; color:#fff;")
PAK:addTypesAsColor({"E"}, "background:#F5C31D; color:#000;")
colors.PAK = PAK
end -- Pakistan
do -- Poland
local POL = Country:new{default = "background:#006A4D; color:#fff;"}
POL:addTypesAsColor({"A", "S"}, "background:#0079C1; color:#fff;")
colors.POL = POL
end --Poland
do -- Slovakia
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