#340 colorblind modes for rtu, reactor-plc, and supervisor

This commit is contained in:
Mikayla Fischler
2024-03-11 21:25:34 -04:00
parent d5b166dcc6
commit b3f29566ea
14 changed files with 226 additions and 60 deletions

View File

@@ -19,9 +19,10 @@ local ui = {
-- try to start the UI
---@param units table RTU units
---@param theme integer front panel theme ID (1 = sandstone, 2 = basalt)
---@param theme FP_THEME front panel theme
---@param color_mode COLOR_MODE color mode
---@return boolean success, any error_msg
function renderer.try_start_ui(units, theme)
function renderer.try_start_ui(units, theme, color_mode)
local status, msg = true, nil
if ui.display == nil then
@@ -39,10 +40,16 @@ function renderer.try_start_ui(units, theme)
term.setPaletteColor(style.theme.colors[i].c, style.theme.colors[i].hex)
end
-- apply color mode
local c_mode_overrides = style.theme.color_modes[color_mode]
for i = 1, #c_mode_overrides do
term.setPaletteColor(c_mode_overrides[i].c, c_mode_overrides[i].hex)
end
-- init front panel view
status, msg = pcall(function ()
ui.display = DisplayBox{window=term.current(),fg_bg=style.fp.root}
panel_view(ui.display, units)
panel_view(ui.display, units, color_mode)
end)
if status then