mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
simplified checks for colorblind mode
This commit is contained in:
@ -36,8 +36,7 @@ local ind_red = style.ind_red
|
||||
|
||||
-- create new front panel view
|
||||
---@param panel graphics_element main displaybox
|
||||
---@param color_mode COLOR_MODE color mode
|
||||
local function init(panel, color_mode)
|
||||
local function init(panel)
|
||||
local s_hi_box = style.theme.highlight_box
|
||||
|
||||
local disabled_fg = style.fp.disabled_fg
|
||||
@ -61,7 +60,7 @@ local function init(panel, color_mode)
|
||||
local reactor = LEDPair{parent=system,label="REACTOR",off=colors.red,c1=colors.yellow,c2=colors.green}
|
||||
local modem = LED{parent=system,label="MODEM",colors=ind_grn}
|
||||
|
||||
if color_mode == themes.COLOR_MODE.STANDARD then
|
||||
if not style.colorblind then
|
||||
local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,colors.gray}}
|
||||
network.update(types.PANEL_LINK_STATE.DISCONNECTED)
|
||||
network.register(databus.ps, "link_state", network.update)
|
||||
|
@ -12,20 +12,24 @@ local cpair = core.cpair
|
||||
|
||||
style.theme = themes.sandstone
|
||||
style.fp = themes.get_fp_style(style.theme)
|
||||
style.colorblind = false
|
||||
|
||||
style.ind_grn = cpair(colors.green, colors.green_off)
|
||||
style.ind_red = cpair(colors.red, colors.red_off)
|
||||
|
||||
-- set theme per configuration
|
||||
---@param fp integer fp theme ID (1 = sandstone, 2 = basalt)
|
||||
function style.set_theme(fp)
|
||||
if fp == 1 then
|
||||
---@param fp FP_THEME front panel theme
|
||||
---@param color_mode COLOR_MODE the color mode to use
|
||||
function style.set_theme(fp, color_mode)
|
||||
if fp == themes.FP_THEME.SANDSTONE then
|
||||
style.theme = themes.sandstone
|
||||
elseif fp == 2 then
|
||||
elseif fp == themes.FP_THEME.BASALT then
|
||||
style.theme = themes.basalt
|
||||
end
|
||||
|
||||
style.fp = themes.get_fp_style(style.theme)
|
||||
|
||||
style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD
|
||||
end
|
||||
|
||||
return style
|
||||
|
@ -26,7 +26,7 @@ function renderer.try_start_ui(theme, color_mode)
|
||||
|
||||
if ui.display == nil then
|
||||
-- set theme
|
||||
style.set_theme(theme)
|
||||
style.set_theme(theme, color_mode)
|
||||
|
||||
-- reset terminal
|
||||
term.setTextColor(colors.white)
|
||||
@ -48,7 +48,7 @@ function renderer.try_start_ui(theme, color_mode)
|
||||
-- init front panel view
|
||||
status, msg = pcall(function ()
|
||||
ui.display = DisplayBox{window=term.current(),fg_bg=style.fp.root}
|
||||
panel_view(ui.display, color_mode)
|
||||
panel_view(ui.display)
|
||||
end)
|
||||
|
||||
if status then
|
||||
|
Reference in New Issue
Block a user