Module:Adjacent stations/sandbox: Difference between revisions

Content deleted Content added
fix class name
test always generating color and background in _style
Line 843:
local result = {}
local data = args.data
local default = 'background-color:#efefef; color: black;' -- Default background color for {{Infobox station}}
if system or data then
data = data or getData(system, true)
Line 858:
end
 
if style == 'header' or style == 'subheader' then
local nameFormat = ''
local tmp = data['name format'] and getValue(data['name format'])
elseif if style == 'subheaderheader' then
if tmp then table.insert(result, tmp) end
local tmp nameFormat = data['name format'] and getValue(data['name format'])
elseif style == 'subheader' then
if tmpnameFormat then table.insert(result, tmp) end
local tmp = data['header background color'] and getValue(data['header background color'])
if tmp thenend
 
table.insert(result, 'background-color:#' .. tmp)
if not mw.ustring.match( nameFormat, 'background' ) then
local color = data['header text color'] and getValue(data['header text color'])
local tmpbackground = data['header background color'] and getValue(data['header background color'])
if color then
if not background then background = '#efefef' end
table.insert(result, 'color:#' .. color)
table.insert(result, 'background-color:#' .. tmpbackground)
elseend
 
if not ( mw.ustring.match( nameFormat, '^color' ) or mw.ustring.match( nameFormat, ' color' ) or mw.ustring.match( nameFormat, ';color' ) ) then
iflocal color then= ''
if data['header text color'] then
local color = data['header text color'] and getValue(data['header text color'])
else
local greatercontrast = require('Module:Color contrast')._greatercontrast
ifcolor = greatercontrast{tmp} == '#FFFFFF' then table.insert(result, 'color:#FFFFFF') end
end
 
else
if color == '' then color = '#ffffff' end
table.insert(result, default)
table.insert(result, 'color:#' .. color)
local color = data['header text color'] and getValue(data['header text color'])
if color then table.insert(result, 'color:#' .. color) end
end
end