Մոդուլ:Basketball color
This module is used by
- {{NBA color}}, {{NBA color cell}}, {{NBA color cell2}}
- {{Euroleague color}}, {{Euroleague color cell}}, {{Euroleague color cell2}},
- {{NBL colour}}, {{NBL colour cell}}, {{NBL colour cell2}},
- {{PBA color}}, {{PBA color cell}}, {{PBA color cell2}},
- {{European leagues color}}, {{European leagues color cell}}, {{European leagues color cell2}},
- {{KBL color}}, {{KBL color cell}}, {{KBL color cell2}}
- {{Infobox basketball biography/style}}
Usage
Խմբագրել{{#invoke:Basketball color|color}}
in any of the various color templates{{#invoke:Basketball color|colorcell}}
in any of the various color cell templates{{#invoke:Basketball color|colorcell2}}
in any of the various color cell2 templates{{#invoke:Basketball color|check}}
to check to see if a team has defined colors
Updating team colors
ԽմբագրելSee Module:Basketball color/data.
Test table
ԽմբագրելTeam | 1 | 2 | 3 | 4 |
---|---|---|---|---|
A.E.K. Athens | ||||
AEK | ||||
AEK Athens | ||||
AEK Larnaca | ||||
AEK Larnaca B.C. | ||||
AEL | ||||
AEL Limassol | ||||
ALBA Berlin | ||||
APOEL | ||||
APOEL B.C. | ||||
AS Monaco Basket | ||||
ASVEL | ||||
ASVEL Basket | ||||
ASVEL Lyon-Villeurbanne | ||||
AZS Koszalin | ||||
Acea Virtus Roma | ||||
Adelaide 36ers | ||||
Air21 Express | ||||
Alaska Aces | ||||
Alaska Milkmen | ||||
Alba Berlin | ||||
Alba Fehérvár | ||||
Albuquerque Thunderbirds | ||||
Aliağa Petkim | ||||
Alkar | ||||
Allianz Swans Gmunden | ||||
Anadolu Efes Istanbul | ||||
Anadolu Efes S.K. | ||||
Andorra | ||||
Antibes Sharks | ||||
Antwerp Giants | ||||
Anwil Włocławek | ||||
Anyang KGC | ||||
Apollon Limassol | ||||
Apollon Limassol BC | ||||
Apollon Patras | ||||
Aries Trikala | ||||
Aris | ||||
Aris Leeuwarden | ||||
Aris Thessaloniki | ||||
Arkadia Traiskirchen Lions | ||||
Armia | ||||
Artland Dragons | ||||
Asesoft Ploiești | ||||
Asseco Gdynia | ||||
Atlanta Hawks | ||||
Atomerőmű SE | ||||
Austin Spurs | ||||
Austin Toros | ||||
Azad University Tehran | ||||
Azovmash | ||||
B-Meg Derby Ace Llamados | ||||
B-Meg Llamados | ||||
BBC Bayreuth | ||||
BC Andorra | ||||
BC Apollo | ||||
BC Azovmash | ||||
BC Dnipro | ||||
BC Dnipro-Azot | ||||
BC Dnipro-Azot Dniprodzerzhynsk | ||||
BC Donetsk | ||||
BC Ferro-ZNTU | ||||
BC Goverla | ||||
BC Hoverla | ||||
BC Kalev/Cramo | ||||
BC Khimik | ||||
BC Khimki | ||||
BC Krasny Oktyabr | ||||
BC Krasnye Krylia | ||||
BC Krka | ||||
BC Kyiv | ||||
BC Levski Sofia | ||||
BC Lietuvos Rytas | ||||
BC Lietuvos rytas | ||||
BC Neptūnas | ||||
BC Nizhny Novgorod | ||||
BC Odessa | ||||
BC Oostende | ||||
BC Politekhnika-Halychyna | ||||
BC Rakvere Tarvas | ||||
BC Tallinna Kalev | ||||
BC Triumph Lyubertsy | ||||
BC Tsmoki-Minsk | ||||
BC Unics | ||||
BC Ural Yekaterinburg | ||||
BC Yenisey Krasnoyarsk | ||||
BC Zenit Saint Petersburg | ||||
BC Šiauliai | ||||
BC Žalgiris | ||||
BCM Gravelines | ||||
BG Göttingen | ||||
BK Prostějov | ||||
BK VEF Riga | ||||
BK VEF Rīga | ||||
BK Ventspils | ||||
BSC Raiffeisen Panthers Fürstenfeld | ||||
Bakersfield Jam | ||||
Bakken Bears | ||||
Baloncesto Fuenlabrada | ||||
Baloncesto Málaga | ||||
Baloncesto Sevilla | ||||
Banvit | ||||
Banvit B.K. | ||||
Barak Netanya | ||||
Barako Bull Energy | ||||
Barako Bull Energy Boosters | ||||
Barako Bull Energy Cola | ||||
Barako Energy Coffee Masters | ||||
Barangay Ginebra Kings | ||||
Barangay Ginebra San Miguel | ||||
Barons Kvartāls | ||||
Bashkimi Prizren | ||||
Basic-Fit Brussels | ||||
Basket Zaragoza 2002 | ||||
Basketball Löwen Braunschweig | ||||
Belfius Mons-Hainaut | ||||
Belgacom Spirou | ||||
Benfica | ||||
Beşiktaş | ||||
Bilbao Basket | ||||
Bisons Loimaa | ||||
Blackwater Elite | ||||
Bnei Herzliya | ||||
Borac Čačak | ||||
Borås | ||||
Boston Celtics | ||||
Bristol Flyers | ||||
Brooklyn Nets | ||||
Brose Baskets | ||||
Brose Baskets Bamberg | ||||
Budućnost Podgorica | ||||
Buffalo Braves | ||||
Burger King Whoppers | ||||
Busan KT Sonicboom | ||||
Bàsquet Manresa | ||||
Bærum Basket | ||||
CAB Madeira | ||||
CAI Zaragoza | ||||
CB 1939 Canarias | ||||
CB Canarias | ||||
CB Estudiantes | ||||
CB Gran Canaria | ||||
CB Murcia | ||||
CB Málaga | ||||
CB Sevilla | ||||
CB Valladolid | ||||
CDB Sevilla | ||||
CSA Steaua București | ||||
CSKA Moscow | ||||
CSM Oradea | ||||
CSU Asesoft Ploiești | ||||
CSU Sibiu | ||||
Cairns Taipans | ||||
Canton Charge | ||||
Cedevita Zagreb | ||||
Challenge Sports Rotterdam | ||||
Changwon LG Sakers | ||||
Charlotte Bobcats | ||||
Charlotte Hornets | ||||
Cherkaski Mavpy | ||||
Cheshire Phoenix | ||||
Chicago Bulls | ||||
Chin Min Dragons | ||||
Chin Min Dragons UBC Sankt Pölten | ||||
Cholet | ||||
Cholet Basket | ||||
Chorale Roanne | ||||
Chorale Roanne Basket | ||||
Cibona Zagreb | ||||
Cimberio Varese | ||||
Cleveland Cavaliers | ||||
Coca-Cola Tigers | ||||
Colorado 14ers | ||||
Crailsheim Merlins | ||||
Crispa Redmanizers | ||||
Crvena zvezda Telekom Belgrade | ||||
Czarni Słupsk | ||||
Dallas Mavericks | ||||
Darda | ||||
Delaware 87ers | ||||
Den Helder Kings | ||||
Denver Nuggets | ||||
Detroit Pistons | ||||
Dinamo Banco di Sardegna Sassari | ||||
Dinamo Basket Sassari | ||||
Dinamo Sassari | ||||
Dinamo Tbilisi | ||||
Dnipro-Azot | ||||
Donar | ||||
Donar Groningen | ||||
Donetsk | ||||
Dragon Force Porto | ||||
Durham Wildcats | ||||
Dzūkija | ||||
Dzūkija Alytus | ||||
EA7 Emporio Armani Milano | ||||
EGIS Körmend | ||||
ETHA | ||||
ETHA Engomis | ||||
EWE Baskets Oldenburg | ||||
Eastern Conference | ||||
Eco Örebro | ||||
Eisbären Bremerhaven | ||||
Enel Brindisi | ||||
Energia Rovinari | ||||
Energy Invest Rustavi | ||||
Enisey Krasnoyarsk | ||||
Erie BayHawks | ||||
Espoon Honka | ||||
Estudiantes | ||||
Excelsior Brussels | ||||
F.C. Porto | ||||
FC Barcelona | ||||
FC Bayern Munich | ||||
FIATC Joventut | ||||
Falco KC Szombathely | ||||
Fenerbahçe Men's Basketball | ||||
Fenerbahçe Ülker Istanbul | ||||
Feni Industries | ||||
Ferro-ZNTU | ||||
Formula Shell Zoom Masters | ||||
Fort Wayne Mad Ants | ||||
Fraport Skyliners | ||||
GKK Šibenik | ||||
Galatasaray Liv Hospital Istanbul | ||||
Galatasaray S.K. (men's basketball) | ||||
GasTerra Flames | ||||
Gaz Metan Mediaş | ||||
Geofin Nový Jičín | ||||
Ginebra San Miguel | ||||
Giorgio Tesi Pistoia | ||||
Gipuzkoa Basket | ||||
Glasgow Rocks | ||||
GlobalPort Batang Pier | ||||
Gold Coast Blaze | ||||
Golden State Warriors | ||||
Gordon's Gin Boars | ||||
Goyang Orions | ||||
Gran Canaria | ||||
Grand Rapids Drive | ||||
Great Taste Coffee Makers | ||||
Grissin Bon Reggio Emilia | ||||
Groningen | ||||
Guangdong Southern Tigers | ||||
Guerino Vanoli Basket | ||||
Güssing Knights | ||||
HKK Široki | ||||
Hapoel Eilat | ||||
Hapoel Eilat B.C. | ||||
Hapoel Gilboa Galil | ||||
Hapoel Holon | ||||
Hapoel Jerusalem | ||||
Hapoel Jerusalem B.C. | ||||
Hapoel Tel Aviv | ||||
Hapoel Tel Aviv B.C. | ||||
Helsinki Seagulls | ||||
Herbalife Gran Canaria | ||||
Houston Rockets | ||||
Huntsville Flight | ||||
Iberostar Tenerife | ||||
Idaho Stampede | ||||
Igokea | ||||
Incheon ET Land Elephants | ||||
Indiana Pacers | ||||
Iowa Energy | ||||
Ironi Nes Ziona | ||||
Ironi Nes Ziona B.C. | ||||
JDA Dijon | ||||
JDA Dijon Basket | ||||
JSF Nanterre | ||||
Jelgava | ||||
Jeonju KCC Egis | ||||
Joensuun Kataja | ||||
Jolly Jadranska Banka | ||||
Joventut Badalona | ||||
Juvecaserta Basket | ||||
Juventus | ||||
Juventus Utena | ||||
Jászberényi KSE | ||||
Jēkabpils | ||||
Jūrmala | ||||
K.A.O.D. | ||||
KAOD | ||||
KB RTV21 | ||||
KK Alkar | ||||
KK Borac Čačak | ||||
KK Budućnost Podgorica | ||||
KK Cedevita | ||||
KK Cibona | ||||
KK Crnokosa | ||||
KK Crvena zvezda | ||||
KK Darda | ||||
KK HITO | ||||
KK Igokea | ||||
KK Jolly Jadranska Banka | ||||
KK Križevci | ||||
KK Kvarner 2010 | ||||
KK MZT Skopje | ||||
KK Mega Vizura | ||||
KK Partizan | ||||
KK Pärnu | ||||
KK Radnički Kragujevac | ||||
KK Slavonski Brod | ||||
KK Split | ||||
KK Union Olimpija | ||||
KK Zabok | ||||
KK Zadar | ||||
KK Zagreb | ||||
KTP Kotka | ||||
KTP-Basket | ||||
Kalev/Cramo | ||||
Kangoeroes Basket Willebroek | ||||
Kapfenberg Bulls | ||||
Kauhajoen Karhu | ||||
Keravnos | ||||
Keravnos B.C. | ||||
Keravnos Strovolos | ||||
Khimik | ||||
Khimik Yuzhne | ||||
Khimki | ||||
Kia Sorento | ||||
Kolossos Rodou | ||||
Korikobrat | ||||
Kouvot | ||||
Kozuv | ||||
Krasny Oktyabr | ||||
Krasnye Krylia | ||||
Križevci | ||||
Krka | ||||
Krka Novo Mesto | ||||
Kumanovo | ||||
Kvarner 2010 | ||||
Kyiv | ||||
Körmend | ||||
LF Basket Norrbotten | ||||
La Bruixa d'Or | ||||
La Bruixa d'Or Manresa | ||||
Laboral Kutxa | ||||
Laboral Kutxa Baskonia | ||||
Laboral Kutxa Vitoria | ||||
Lagun Aro GBC | ||||
Landstede Basketbal | ||||
Le Mans Sarthe | ||||
Le Mans Sarthe Basket | ||||
Leeds Force | ||||
Leicester Riders | ||||
Leones de Ponce | ||||
Leuven Bears | ||||
Levski Sofia | ||||
Liepājas Lauvas | ||||
Lietkabelis | ||||
Lietuvos Rytas | ||||
Lietuvos Rytas Vilnius | ||||
Lietuvos rytas | ||||
Lietuvos rytas Vilnius | ||||
Limburg United | ||||
Limoges CSP | ||||
Liège Basket | ||||
Lokomotiv Kuban | ||||
Lokomotiv Kuban Krasnodar | ||||
Lokomotiv-Kuban | ||||
London Lions | ||||
Los Angeles Clippers | ||||
Los Angeles D-Fenders | ||||
Los Angeles Lakers | ||||
Lusitânia | ||||
Löwen Braunschweig | ||||
MHP Riesen Ludwigsburg | ||||
MIA Academy | ||||
MZT Aerodrom | ||||
MZT Skopje | ||||
Maccabi Ashdod | ||||
Maccabi Ashdod B.C. | ||||
Maccabi Electra Tel Aviv | ||||
Maccabi Haifa | ||||
Maccabi Haifa B.C. | ||||
Maccabi Rishon LeZion | ||||
Maccabi Tel Avi B.C. | ||||
Maine Red Claws | ||||
Manchester Giants | ||||
Manila Beer Brewmasters | ||||
Mapooro Cantù | ||||
Matrixx Magixx | ||||
Maxxcom BSW | ||||
Mažeikiai | ||||
Medi Bayreuth | ||||
Mega Vizura | ||||
Melbourne Tigers | ||||
Melbourne United | ||||
Memphis Grizzlies | ||||
Meralco Bolts | ||||
Mersin Büyükşehir Belediyesi S.K. | ||||
Miami Heat | ||||
Milwaukee Bucks | ||||
Minnesota Timberwolves | ||||
Mitteldeutscher | ||||
Mitteldeutscher BC | ||||
Montakit Fuenlabrada | ||||
MoraBanc Andorra | ||||
Morabanc Andorra | ||||
Mureș | ||||
Mywigo Valladolid | ||||
NLEX Road Warriors | ||||
Namika Lahti | ||||
Nanterre | ||||
Nea Kifisia | ||||
Neptūnas Klaipėda | ||||
Nevėžis | ||||
New Basket Brindisi | ||||
New Jersey Nets | ||||
New Mexico Thunderbirds | ||||
New Orleans Hornets | ||||
New Orleans Pelicans | ||||
New York Knicks | ||||
New York Nets | ||||
New Yorker Phantoms Braunschweig | ||||
New Zealand Breakers | ||||
Newcastle Eagles | ||||
Nilan Bisons | ||||
Nilan Bisons Loimaa | ||||
Nizhny Novgorod | ||||
Norrköping Dolphins | ||||
Obradoiro | ||||
Obradoiro CAB | ||||
Odessa | ||||
Okapi Aalstar | ||||
Oklahoma City Blue | ||||
Oklahoma City Thunder | ||||
Olimpia Milano | ||||
Olin Edirne Basket | ||||
Oliveirense | ||||
Olympiacos | ||||
Olympiacos B.C. | ||||
Olympiacos Piraeus | ||||
Olympique Antibes | ||||
Orlando Magic | ||||
Orléans Loiret | ||||
Orléans Loiret Basket | ||||
Ovarense | ||||
P.A.O.K. | ||||
PAOK | ||||
PAOK Thessaloniki | ||||
PBC CSKA Moscow | ||||
PBC Lokomotiv Kuban | ||||
PBC Lokomotiv-Kuban | ||||
PBC Lukoil Academic | ||||
PGE Turów Zgorzelec | ||||
PVSK Panthers | ||||
PVSK-Pannonpower | ||||
Pallacanestro Biella | ||||
Pallacanestro Cantù | ||||
Pallacanestro Reggiana | ||||
Pallacanestro Varese | ||||
Palma Air Europa | ||||
Panathinaikos | ||||
Panathinaikos Athens | ||||
Panathinaikos B.C. | ||||
Panelefsiniakos | ||||
Panionios | ||||
Panthers Fürstenfeld | ||||
Paris-Levallois | ||||
Paris-Levallois Basket | ||||
Partizan NIS Belgrade | ||||
Peja | ||||
Pelister | ||||
Perth Wildcats | ||||
Petron Blaze Boosters | ||||
Phantoms Braunschweig | ||||
Philadelphia 76ers | ||||
Philippines National Basketball Team | ||||
Philippines men's national basketball team | ||||
Phoenix Hagen | ||||
Phoenix Suns | ||||
Pieno žvaigždės | ||||
Pistoia Basket 2000 | ||||
Piteşti | ||||
Plymouth Raiders | ||||
Politekhnika-Halychyna | ||||
Pop Cola Panthers | ||||
Port of Antwerp Giants | ||||
Port of Den Helder Kings | ||||
Portland Trail Blazers | ||||
Powerade Tigers | ||||
Prienai | ||||
Prienai TonyBet | ||||
Prostějov | ||||
Purefoods Hotdogs | ||||
Purefoods Star Hotshots | ||||
Purefoods TJ Giants | ||||
Purefoods TJ Hotdogs | ||||
Pınar Karşıyaka | ||||
Quilmes | ||||
Rabotnički | ||||
Radnički Kragujevac | ||||
Raiffeisen Graz | ||||
Rain or Shine Elasto Painters | ||||
Rakvere Tarvas | ||||
Ratiopharm Ulm | ||||
Real Madrid | ||||
Real Madrid Baloncesto | ||||
Red Bull Barako | ||||
Reno Bighorns | ||||
Rethymno Aegean | ||||
Reyer Venezia Mestre | ||||
Rio Grande Valley Vipers | ||||
Rosa Radom | ||||
Royal Halı Gaziantep | ||||
Río Natura Monbús | ||||
Río Natura Monbús Obradoiro | ||||
S.S. Felice Scandone | ||||
SC Rasta Vechta | ||||
SCM CSU Craiova | ||||
SLUC Nancy | ||||
SLUC Nancy Basket | ||||
SOMB Boulogne-sur-Mer | ||||
SPM Shoeters Den Bosch | ||||
STB Le Havre | ||||
Sacramento Kings | ||||
San Antonio Spurs | ||||
San Mig Coffee Mixers | ||||
San Mig Super Coffee Mixers | ||||
San Miguel Beermen | ||||
San Sebastián Gipuzkoa BC | ||||
Santa Cruz Warriors | ||||
Selçuk Üniversitesi BK | ||||
Seoul SK Knights | ||||
Seoul Samsung Thunders | ||||
Sevilla | ||||
Sheffield Sharks | ||||
Shell Turbo Chargers | ||||
Shopinas.com Clickers | ||||
Siarka Tarnobrzeg | ||||
Sidigas Avellino | ||||
Sigal Prishtina | ||||
Sioux Falls Skyforce | ||||
Skyliners Frankfurt | ||||
Slavonski Brod | ||||
Smart Gilas Pilipinas | ||||
Smart-Gilas Pilipinas | ||||
Solna Vikings | ||||
South Korea national basketball team | ||||
Spirou Charleroi | ||||
Split | ||||
Springfield Armor | ||||
Sta. Lucia Realtors | ||||
Stella Artois Leuven Bears | ||||
Stelmet Zielona Góra | ||||
Strasbourg | ||||
Strasbourg IG | ||||
Sukhumi | ||||
Sundsvall Dragons | ||||
Surrey United | ||||
Sutor Basket Montegranaro | ||||
Svendborg Rabbits | ||||
Sydney Kings | ||||
Szolnoki Olaj | ||||
Szolnoki Olaj KK | ||||
Södertälje Kings | ||||
TBB Trier | ||||
TED Ankara Kolejliler | ||||
TTÜ | ||||
TTÜ KK | ||||
TYCO Rapla | ||||
Talk 'N Text Tropang Texters | ||||
Tallinna Kalev | ||||
Tampereen Pyrintö | ||||
Tanduay Rhum Masters | ||||
Tapiolan Honka | ||||
Tarbes-Lourdes | ||||
Tartu Ülikool Korvpallimeeskond | ||||
Tartu Ülikool/Rock | ||||
Telekom Baskets | ||||
Telekom Baskets Bonn | ||||
Telenet BC Oostende | ||||
Telenet Oostende | ||||
Texas Legends | ||||
Tigers Tübingen | ||||
Timba Timişoara | ||||
Timișoara | ||||
Tofaş | ||||
Tofaş S.K. | ||||
Torku Selçuk Üniversitesi | ||||
Toronto Raptors | ||||
Torpan Pojat | ||||
Townsville Crocodiles | ||||
Toyota Super Corollas | ||||
Trabzonspor | ||||
Trabzonspor Basketball | ||||
Trefl Sopot | ||||
Trenkwalder Reggio Emilia | ||||
Trepça | ||||
Triumph Lyubertsy | ||||
Tsmoki-Minsk | ||||
Tuenti Móvil Estudiantes | ||||
Tulsa 66ers | ||||
Türk Telekom | ||||
Türk Telekom B.K. | ||||
U BT Cluj-Napoca | ||||
U/Tex Wranglers | ||||
UBC Güssing Knights | ||||
UBC Magnofit Güssing Knights | ||||
UBC Sankt Pölten | ||||
UBSC Raiffeisen Graz | ||||
UCAM Murcia | ||||
UNICS Kazan | ||||
Ulsan Mobis Phoebus | ||||
Umana Reyer Venezia | ||||
Umana Venezia | ||||
Unicaja Málaga | ||||
Unics Kazan | ||||
Union Olimpija | ||||
United States National Basketball Team | ||||
Universitatea Cluj | ||||
Uppsala | ||||
Ural Yekaterinburg | ||||
Utah Jazz | ||||
Uşak Sportif | ||||
VEF Rīga | ||||
VOO Wolves Verviers-Pepinster | ||||
Valencia | ||||
Valencia BC | ||||
Valencia Basket | ||||
Valencia Basket Club | ||||
Valga KK | ||||
Valga/Maks & Moorits | ||||
Valladolid | ||||
Valmiera | ||||
Vanoli Cremona | ||||
Vardar | ||||
Ventspils | ||||
Victoria Libertas Pesaro | ||||
Virtus Bologna | ||||
Virtus Pallacanestro Bologna | ||||
Virtus Roma | ||||
Vitória de Guimarães | ||||
WBC Raiffeisen Wels | ||||
Walter Tigers Tübingen | ||||
Washington Wizards | ||||
Westchester Knicks | ||||
Western Conference | ||||
Westports Malaysia Dragons | ||||
Wollongong Hawks | ||||
Wonju Dongbu Promy | ||||
Worcester Wolves | ||||
Xion Dukes Klosterneuburg | ||||
Yenisey Krasnoyarsk | ||||
Zabok | ||||
Zadar | ||||
Zenit Saint Petersburg | ||||
Zepter Vienna | ||||
Zielona Góra | ||||
Zorg en Zekerheid Leiden | ||||
ece Bulls Kapfenberg | ||||
medi Bayreuth | ||||
ratiopharm Ulm | ||||
s.Oliver Baskets | ||||
Élan Béarnais Pau-Orthez | ||||
Élan Chalon | ||||
ČEZ Nymburk | ||||
Śląsk Wrocław | ||||
Šiauliai | ||||
Šibenik | ||||
Žalgiris Kaunas | ||||
Free agent | ||||
Retired |
--
-- This module implements
-- {{NBA color}}, {{NBA color cell}}, {{NBA color cell2}}
-- {{Euroleague color}}, {{Euroleague color cell}}, {{Euroleague color cell2}},
-- {{NBL colour}}, {{NBL colour cell}}, {{NBL colour cell2}},
-- {{PBA color}}, {{PBA color cell}}, {{PBA color cell2}},
-- {{European leagues color}}, {{European leagues color cell}}, {{European leagues color cell2}},
-- {{KBL color}}, {{KBL color cell}}, {{KBL color cell2}}
--
local p = {}
local data_module = "Module:Basketball color/data"
local function stripwhitespace(text)
return text:match("^%s*(.-)%s*$")
end
local function get_colors(team, unknown)
team = stripwhitespace(team or '')
unknown = unknown or {"DCDCDC", "000000", "000000", "FFFFFF"}
local use_default = {
[""] = 1,
["retired"] = 1,
["free agent"] = 1,
}
local colors = nil
if ( team and use_default[team:lower()] ) then
colors = {"DCDCDC", "000000", "000000", "FFFFFF"}
else
local all_colors = mw.loadData(data_module)
colors = all_colors[team]
if ( colors and type(colors) == 'string' ) then
colors = all_colors[colors]
end
end
return colors or unknown
end
local function team_color(team, num)
local colors = get_colors(team, nil)
-- tracking for broken NBA Eastern Conference and NBA Western Conference syntax
-- if (team:match("Eastern Conference") or team:match("Western Conference")) then
-- if(num == '') then
-- local track = mw.loadData("Module:Basketball color/tracking")
-- end
-- end
num = tonumber(num:match('[1-4]') or '0')
if ( num ) then
return colors[num]
else
return ''
end
end
local function team_colorcell(team, borderwidth, bg, fg, bd)
local colors = get_colors(team, nil)
local border = ''
borderwidth = borderwidth or ''
if (borderwidth ~= '') then
border = 'border:' .. borderwidth .. 'px solid #' .. colors[bd] .. ';'
end
return 'background-color:#' .. colors[bg] .. ';color:#' .. colors[fg] .. ';' .. border
end
local function team_check(team, unknown)
local colors = get_colors(team, unknown)
if type(colors) == 'table' then
return 'known'
else
return unknown
end
end
local function team_testtable(args, style, data)
local teamlist = {}
if ( data ) then data_module = data end
-- helper function
local function table_row(t, c)
local res = mw.html.create('')
if( c[1] and c[2] and c[3] and c[4] ) then
res:tag('td'):wikitext(t)
else
res:tag('td'):wikitext(t .. ' <span class=error>ERROR</span>')
end
for i=1,4 do
res:tag('td'):css('background', '#' .. (c[i] or 'ERROR'))
end
return tostring(res)
end
-- list of teams
if( args and args[1] ) then
for k, team in pairs(args) do
if type(k) == 'number' then
table.insert(teamlist, team)
end
end
else
local all_colors = mw.loadData(data_module)
for team, colors in pairs( all_colors ) do
table.insert(teamlist, team)
end
table.sort(teamlist)
table.insert(teamlist, 'Free agent')
table.insert(teamlist, 'Retired')
end
-- build table
local root = mw.html.create('table')
root:addClass('wikitable sortable')
:css('font-size', '90%')
:css('line-height', '100%')
:cssText(style)
local row = root:tag('tr')
row:tag('th'):wikitext('Team')
for i=1,4 do
row:tag('th')
:addClass('unsortable')
:wikitext(i)
end
for k, team in pairs( teamlist ) do
row = root:tag('tr')
row:wikitext(table_row(team, get_colors(team)))
end
return tostring(root)
end
function p.color(frame)
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args
return team_color(args[1] or '', args[2] or '')
end
function p.colorcell(frame)
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args
return team_colorcell(args[1] or '', args['border'] or '', 1, 2, 3)
end
function p.colorcell2(frame)
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args
return team_colorcell(args[1] or '', args['border'] or '', 3, 4, 1)
end
function p.check(frame)
local args = (frame.args[1] ~= nil) and frame.args or frame:getParent().args
return team_check(args[1] or '', args[2] or '')
end
function p.testtable(frame)
return team_testtable((frame.args[1] ~= nil) and frame.args or frame:getParent().args, frame.args['style'] or '', frame.args['data'])
end
return p