From bb2c07963be360ab8623b7b4c413c4245784e20f Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 24 Mar 2024 12:56:51 -0400 Subject: [PATCH 1/6] #457 work on blue indicator modes --- coordinator/configure.lua | 5 +- coordinator/coordinator.lua | 4 +- coordinator/startup.lua | 2 +- coordinator/ui/layout/front_panel.lua | 4 +- coordinator/ui/style.lua | 7 ++- graphics/themes.lua | 81 +++++++++++++++++++++++---- reactor-plc/configure.lua | 5 +- reactor-plc/panel/front_panel.lua | 4 +- reactor-plc/plc.lua | 4 +- reactor-plc/startup.lua | 2 +- rtu/configure.lua | 5 +- rtu/panel/front_panel.lua | 4 +- rtu/rtu.lua | 4 +- rtu/startup.lua | 2 +- supervisor/configure.lua | 5 +- supervisor/startup.lua | 2 +- supervisor/supervisor.lua | 4 +- 17 files changed, 108 insertions(+), 36 deletions(-) diff --git a/coordinator/configure.lua b/coordinator/configure.lua index 5b223e8..0206667 100644 --- a/coordinator/configure.lua +++ b/coordinator/configure.lua @@ -44,7 +44,8 @@ local RIGHT = core.ALIGN.RIGHT -- changes to the config data/format to let the user know local changes = { { "v1.2.4", { "Added temperature scale options" } }, - { "v1.2.12", { "Added main UI theme", "Added front panel UI theme", "Added color accessibility modes" } } + { "v1.2.12", { "Added main UI theme", "Added front panel UI theme", "Added color accessibility modes" } }, + { "v1.3.3", { "Added blue indicators color mode" } } } ---@class crd_configurator @@ -846,7 +847,7 @@ local function config_view(display) _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - TextBox{parent=clr_c_2,x=1,y=14,height=6,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/coordinator/coordinator.lua b/coordinator/coordinator.lua index 85387b4..a8d6e5e 100644 --- a/coordinator/coordinator.lua +++ b/coordinator/coordinator.lua @@ -4,6 +4,8 @@ local ppm = require("scada-common.ppm") local util = require("scada-common.util") local types = require("scada-common.types") +local themes = require("graphics.themes") + local iocontrol = require("coordinator.iocontrol") local process = require("coordinator.process") @@ -100,7 +102,7 @@ function coordinator.load_config() cfv.assert_type_int(config.FrontPanelTheme) cfv.assert_range(config.FrontPanelTheme, 1, 2) cfv.assert_type_int(config.ColorMode) - cfv.assert_range(config.ColorMode, 1, 4) + cfv.assert_range(config.ColorMode, 1, themes.COLOR_MODE.NUM_MODES) -- Monitor Setup diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 7010500..1a660f6 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -22,7 +22,7 @@ local sounder = require("coordinator.sounder") local apisessions = require("coordinator.session.apisessions") -local COORDINATOR_VERSION = "v1.3.2" +local COORDINATOR_VERSION = "v1.3.3" local CHUNK_LOAD_DELAY_S = 30.0 diff --git a/coordinator/ui/layout/front_panel.lua b/coordinator/ui/layout/front_panel.lua index 455e42e..ebaba12 100644 --- a/coordinator/ui/layout/front_panel.lua +++ b/coordinator/ui/layout/front_panel.lua @@ -65,8 +65,8 @@ local function init(panel, num_units) network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.red_off,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.red_off,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.black,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.black,c1=colors.red,c2=colors.green} nt_lnk.register(ps, "link_state", function (state) local value = 2 diff --git a/coordinator/ui/style.lua b/coordinator/ui/style.lua index 13379b7..cec21d6 100644 --- a/coordinator/ui/style.lua +++ b/coordinator/ui/style.lua @@ -89,16 +89,17 @@ style.theme = smooth_stone ---@param color_mode COLOR_MODE the color mode to use function style.set_themes(main, fp, color_mode) local colorblind = color_mode ~= themes.COLOR_MODE.STANDARD + local black_ind_off = colorblind and (color_mode ~= themes.COLOR_MODE.BLUE_IND) style.ind_bkg = colors.gray - style.ind_hi_box_bg = util.trinary(colorblind, colors.black, colors.gray) + style.ind_hi_box_bg = util.trinary(black_ind_off, colors.black, colors.gray) if main == themes.UI_THEME.SMOOTH_STONE then style.theme = smooth_stone - style.ind_bkg = util.trinary(colorblind, colors.black, colors.gray) + style.ind_bkg = util.trinary(black_ind_off, colors.black, colors.gray) elseif main == themes.UI_THEME.DEEPSLATE then style.theme = deepslate - style.ind_hi_box_bg = util.trinary(colorblind, colors.black, colors.lightGray) + style.ind_hi_box_bg = util.trinary(black_ind_off, colors.black, colors.lightGray) end style.colorblind = colorblind diff --git a/graphics/themes.lua b/graphics/themes.lua index b59b504..e7bf00f 100644 --- a/graphics/themes.lua +++ b/graphics/themes.lua @@ -54,14 +54,19 @@ themes.COLOR_MODE = { STANDARD = 1, DEUTERANOPIA = 2, PROTANOPIA = 3, - TRITANOPIA = 4 + TRITANOPIA = 4, + BLUE_IND = 5, + BLUE_ON_BLACK = 6, + NUM_MODES = 6 } themes.COLOR_MODE_NAMES = { "Standard", "Deuteranopia", "Protanopia", - "Tritanopia" + "Tritanopia", + "Blue Standard", + "Blue + Black Off" } -- attempts to get the string name of a color mode @@ -72,7 +77,9 @@ function themes.color_mode_name(id) if id == themes.COLOR_MODE.STANDARD or id == themes.COLOR_MODE.DEUTERANOPIA or id == themes.COLOR_MODE.PROTANOPIA or - id == themes.COLOR_MODE.TRITANOPIA then + id == themes.COLOR_MODE.TRITANOPIA or + id == themes.COLOR_MODE.BLUE_IND or + id == themes.COLOR_MODE.BLUE_ON_BLACK then return themes.COLOR_MODE_NAMES[id] else return nil end end @@ -147,6 +154,20 @@ themes.sandstone = { { c = colors.yellow_off, hex = 0x141414 }, { c = colors.red, hex = 0xff0000 }, { c = colors.red_off, hex = 0x141414 } + }, + -- blue indicators + { + { c = colors.green, hex = 0x1081ff }, + { c = colors.green_hc, hex = 0x1081ff }, + { c = colors.green_off, hex = 0x053466 }, + }, + -- blue indicators, black backgrounds + { + { c = colors.green, hex = 0x1081ff }, + { c = colors.green_hc, hex = 0x1081ff }, + { c = colors.green_off, hex = 0x141414 }, + { c = colors.yellow_off, hex = 0x141414 }, + { c = colors.red_off, hex = 0x141414 } } } } @@ -180,8 +201,8 @@ themes.basalt = { { c = colors.white, hex = 0xbfbfbf }, { c = colors.lightGray, hex = 0x848794 }, { c = colors.gray, hex = 0x5c5f68 }, - { c = colors.black, hex = 0x262626 }, - { c = colors.red_off, hex = 0x653839 } + { c = colors.black, hex = 0x333333 }, + { c = colors.red_off, hex = 0x512d2d } }, color_modes = { @@ -216,6 +237,20 @@ themes.basalt = { { c = colors.yellow_off, hex = 0x333333 }, { c = colors.red, hex = 0xdf4949 }, { c = colors.red_off, hex = 0x333333 } + }, + -- blue indicators + { + { c = colors.green, hex = 0x65aeff }, + { c = colors.green_hc, hex = 0x99c9ff }, + { c = colors.green_off, hex = 0x365e8a }, + }, + -- blue indicators, black backgrounds + { + { c = colors.green, hex = 0x65aeff }, + { c = colors.green_hc, hex = 0x99c9ff }, + { c = colors.green_off, hex = 0x333333 }, + { c = colors.yellow_off, hex = 0x333333 }, + { c = colors.red_off, hex = 0x333333 } } } } @@ -272,19 +307,31 @@ themes.smooth_stone = { { { c = colors.blue, hex = 0x1081ff }, { c = colors.yellow, hex = 0xf7c311 }, - { c = colors.red, hex = 0xfb5615 }, + { c = colors.red, hex = 0xfb5615 } }, -- protanopia { { c = colors.blue, hex = 0x1081ff }, { c = colors.yellow, hex = 0xf5e633 }, - { c = colors.red, hex = 0xff521a }, + { c = colors.red, hex = 0xff521a } }, -- tritanopia { { c = colors.blue, hex = 0x40cbd7 }, { c = colors.yellow, hex = 0xffbc00 }, - { c = colors.red, hex = 0xff0000 }, + { c = colors.red, hex = 0xff0000 } + }, + -- blue indicators + { + { c = colors.blue, hex = 0x1081ff }, + { c = colors.yellow, hex = 0xfffc79 }, + { c = colors.red, hex = 0xdf4949 } + }, + -- blue indicators, black backgrounds + { + { c = colors.blue, hex = 0x1081ff }, + { c = colors.yellow, hex = 0xfffc79 }, + { c = colors.red, hex = 0xdf4949 } } } } @@ -318,19 +365,31 @@ themes.deepslate = { { { c = colors.blue, hex = 0x65aeff }, { c = colors.yellow, hex = 0xf7c311 }, - { c = colors.red, hex = 0xfb5615 }, + { c = colors.red, hex = 0xfb5615 } }, -- protanopia { { c = colors.blue, hex = 0x65aeff }, { c = colors.yellow, hex = 0xf5e633 }, - { c = colors.red, hex = 0xff8058 }, + { c = colors.red, hex = 0xff8058 } }, -- tritanopia { { c = colors.blue, hex = 0x00ecff }, { c = colors.yellow, hex = 0xffbc00 }, - { c = colors.red, hex = 0xdf4949 }, + { c = colors.red, hex = 0xdf4949 } + }, + -- blue indicators + { + { c = colors.blue, hex = 0x65aeff }, + { c = colors.yellow, hex = 0xd9cf81 }, + { c = colors.red, hex = 0xeb6a6c } + }, + -- blue indicators, black backgrounds + { + { c = colors.blue, hex = 0x65aeff }, + { c = colors.yellow, hex = 0xd9cf81 }, + { c = colors.red, hex = 0xeb6a6c } } } } diff --git a/reactor-plc/configure.lua b/reactor-plc/configure.lua index 7f6dce5..018df10 100644 --- a/reactor-plc/configure.lua +++ b/reactor-plc/configure.lua @@ -39,7 +39,8 @@ local RIGHT = core.ALIGN.RIGHT local changes = { { "v1.6.2", { "AuthKey minimum length is now 8 (if set)" } }, { "v1.6.8", { "ConnTimeout can now have a fractional part" } }, - { "v1.6.15", { "Added front panel UI theme", "Added color accessibility modes" } } + { "v1.6.15", { "Added front panel UI theme", "Added color accessibility modes" } }, + { "v1.7.3", { "Added blue indicators color mode" } } } ---@class plc_configurator @@ -484,7 +485,7 @@ local function config_view(display) _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - TextBox{parent=clr_c_2,x=1,y=14,height=6,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/reactor-plc/panel/front_panel.lua b/reactor-plc/panel/front_panel.lua index b54cd04..67b886f 100644 --- a/reactor-plc/panel/front_panel.lua +++ b/reactor-plc/panel/front_panel.lua @@ -64,8 +64,8 @@ local function init(panel) network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(databus.ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.red_off,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.red_off,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.black,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.black,c1=colors.red,c2=colors.green} local nt_col = LED{parent=system,label="NT COLLISION",colors=ind_red} nt_lnk.register(databus.ps, "link_state", function (state) diff --git a/reactor-plc/plc.lua b/reactor-plc/plc.lua index 1a6b32f..b5c299d 100644 --- a/reactor-plc/plc.lua +++ b/reactor-plc/plc.lua @@ -6,6 +6,8 @@ local rsio = require("scada-common.rsio") local types = require("scada-common.types") local util = require("scada-common.util") +local themes = require("graphics.themes") + local databus = require("reactor-plc.databus") local plc = {} @@ -84,7 +86,7 @@ function plc.load_config() cfv.assert_type_int(config.FrontPanelTheme) cfv.assert_range(config.FrontPanelTheme, 1, 2) cfv.assert_type_int(config.ColorMode) - cfv.assert_range(config.ColorMode, 1, 4) + cfv.assert_range(config.ColorMode, 1, themes.COLOR_MODE.NUM_MODES) -- check emergency coolant configuration if enabled if config.EmerCoolEnable then diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index da79744..ca5eb80 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -18,7 +18,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.7.2" +local R_PLC_VERSION = "v1.7.3" local println = util.println local println_ts = util.println_ts diff --git a/rtu/configure.lua b/rtu/configure.lua index 587ffeb..dc78fa9 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -77,7 +77,8 @@ assert(#PORT_DSGN == rsio.NUM_PORTS) -- changes to the config data/format to let the user know local changes = { { "v1.7.9", { "ConnTimeout can now have a fractional part" } }, - { "v1.7.15", { "Added front panel UI theme", "Added color accessibility modes" } } + { "v1.7.15", { "Added front panel UI theme", "Added color accessibility modes" } }, + { "v1.9.2", { "Added blue indicators color mode" } } } ---@class rtu_rs_definition @@ -539,7 +540,7 @@ local function config_view(display) _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - TextBox{parent=clr_c_2,x=1,y=14,height=6,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index d479302..a1a72b9 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -57,8 +57,8 @@ local function init(panel, units) network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(databus.ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.red_off,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.red_off,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.black,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.black,c1=colors.red,c2=colors.green} nt_lnk.register(databus.ps, "link_state", function (state) local value = 2 diff --git a/rtu/rtu.lua b/rtu/rtu.lua index 803c9aa..7e00b98 100644 --- a/rtu/rtu.lua +++ b/rtu/rtu.lua @@ -5,6 +5,8 @@ local log = require("scada-common.log") local types = require("scada-common.types") local util = require("scada-common.util") +local themes = require("graphics.themes") + local databus = require("rtu.databus") local modbus = require("rtu.modbus") @@ -69,7 +71,7 @@ function rtu.load_config() cfv.assert_type_int(config.FrontPanelTheme) cfv.assert_range(config.FrontPanelTheme, 1, 2) cfv.assert_type_int(config.ColorMode) - cfv.assert_range(config.ColorMode, 1, 4) + cfv.assert_range(config.ColorMode, 1, themes.COLOR_MODE.NUM_MODES) cfv.assert_type_table(config.Peripherals) cfv.assert_type_table(config.Redstone) diff --git a/rtu/startup.lua b/rtu/startup.lua index 071ab40..81f2ef9 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.9.1" +local RTU_VERSION = "v1.9.2" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE diff --git a/supervisor/configure.lua b/supervisor/configure.lua index f9bc10d..130ff5c 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -36,7 +36,8 @@ local RIGHT = core.ALIGN.RIGHT -- changes to the config data/format to let the user know local changes = { - { "v1.2.12", { "Added front panel UI theme", "Added color accessibility modes" } } + { "v1.2.12", { "Added front panel UI theme", "Added color accessibility modes" } }, + { "v1.3.2", { "Added blue indicators color mode" } } } ---@class svr_configurator @@ -783,7 +784,7 @@ local function config_view(display) _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - TextBox{parent=clr_c_2,x=1,y=14,height=6,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/supervisor/startup.lua b/supervisor/startup.lua index be57a70..cdb2110 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v1.3.1" +local SUPERVISOR_VERSION = "v1.3.2" local println = util.println local println_ts = util.println_ts diff --git a/supervisor/supervisor.lua b/supervisor/supervisor.lua index 43536c6..3d6d7c7 100644 --- a/supervisor/supervisor.lua +++ b/supervisor/supervisor.lua @@ -2,6 +2,8 @@ local comms = require("scada-common.comms") local log = require("scada-common.log") local util = require("scada-common.util") +local themes = require("graphics.themes") + local svsessions = require("supervisor.session.svsessions") local supervisor = {} @@ -87,7 +89,7 @@ function supervisor.load_config() cfv.assert_type_int(config.FrontPanelTheme) cfv.assert_range(config.FrontPanelTheme, 1, 2) cfv.assert_type_int(config.ColorMode) - cfv.assert_range(config.ColorMode, 1, 4) + cfv.assert_range(config.ColorMode, 1, themes.COLOR_MODE.NUM_MODES) return cfv.valid() end From 2442e7f972ca74e9e64c3636894859e0437db2b3 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 24 Mar 2024 13:03:48 -0400 Subject: [PATCH 2/6] #457 added ind_bkg for front panels --- coordinator/ui/layout/front_panel.lua | 6 +++--- reactor-plc/panel/front_panel.lua | 6 +++--- reactor-plc/panel/style.lua | 4 ++++ rtu/panel/front_panel.lua | 6 +++--- rtu/panel/style.lua | 4 ++++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/coordinator/ui/layout/front_panel.lua b/coordinator/ui/layout/front_panel.lua index ebaba12..d23712b 100644 --- a/coordinator/ui/layout/front_panel.lua +++ b/coordinator/ui/layout/front_panel.lua @@ -61,12 +61,12 @@ local function init(panel, num_units) local modem = LED{parent=system,label="MODEM",colors=led_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,colors.gray}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.black,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.black,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=style.ind_bkg,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=style.ind_bkg,c1=colors.red,c2=colors.green} nt_lnk.register(ps, "link_state", function (state) local value = 2 diff --git a/reactor-plc/panel/front_panel.lua b/reactor-plc/panel/front_panel.lua index 67b886f..ee2f3ed 100644 --- a/reactor-plc/panel/front_panel.lua +++ b/reactor-plc/panel/front_panel.lua @@ -60,12 +60,12 @@ local function init(panel) local modem = LED{parent=system,label="MODEM",colors=ind_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,colors.gray}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(databus.ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.black,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.black,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=style.ind_bkg,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=style.ind_bkg,c1=colors.red,c2=colors.green} local nt_col = LED{parent=system,label="NT COLLISION",colors=ind_red} nt_lnk.register(databus.ps, "link_state", function (state) diff --git a/reactor-plc/panel/style.lua b/reactor-plc/panel/style.lua index 08c1192..7f5661f 100644 --- a/reactor-plc/panel/style.lua +++ b/reactor-plc/panel/style.lua @@ -2,6 +2,8 @@ -- Graphics Style Options -- +local util = require("scada-common.util") + local core = require("graphics.core") local themes = require("graphics.themes") @@ -30,6 +32,8 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD + + style.ind_bkg = util.trinary(style.colorblind and (color_mode ~= themes.COLOR_MODE.BLUE_IND), colors.black, colors.gray) end return style diff --git a/rtu/panel/front_panel.lua b/rtu/panel/front_panel.lua index a1a72b9..738ccca 100644 --- a/rtu/panel/front_panel.lua +++ b/rtu/panel/front_panel.lua @@ -53,12 +53,12 @@ local function init(panel, units) local modem = LED{parent=system,label="MODEM",colors=ind_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,colors.gray}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(databus.ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=colors.black,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=colors.black,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=style.ind_bkg,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=style.ind_bkg,c1=colors.red,c2=colors.green} nt_lnk.register(databus.ps, "link_state", function (state) local value = 2 diff --git a/rtu/panel/style.lua b/rtu/panel/style.lua index a72df2a..fd5eaf4 100644 --- a/rtu/panel/style.lua +++ b/rtu/panel/style.lua @@ -2,6 +2,8 @@ -- Graphics Style Options -- +local util = require("scada-common.util") + local core = require("graphics.core") local themes = require("graphics.themes") @@ -29,6 +31,8 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD + + style.ind_bkg = util.trinary(style.colorblind and (color_mode ~= themes.COLOR_MODE.BLUE_IND), colors.black, colors.gray) end return style From 93e4590947493431d073c2472d8b629a3a13e3e6 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 24 Mar 2024 13:39:24 -0400 Subject: [PATCH 3/6] #457 added standard with black off --- coordinator/configure.lua | 30 ++++++++++++++++++++---------- coordinator/ui/style.lua | 4 ++-- graphics/themes.lua | 27 +++++++++++++++++++++++---- reactor-plc/configure.lua | 30 ++++++++++++++++++++---------- reactor-plc/panel/style.lua | 4 ++-- rtu/configure.lua | 30 ++++++++++++++++++++---------- rtu/panel/style.lua | 4 ++-- supervisor/configure.lua | 30 ++++++++++++++++++++---------- supervisor/panel/style.lua | 2 +- 9 files changed, 110 insertions(+), 51 deletions(-) diff --git a/coordinator/configure.lua b/coordinator/configure.lua index 0206667..c85346a 100644 --- a/coordinator/configure.lua +++ b/coordinator/configure.lua @@ -825,29 +825,39 @@ local function config_view(display) TextBox{parent=clr_c_1,x=18,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=18,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color blindness below, blues will be used instead of greens on indicators and multi-color indicators will be split up as space permits."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + + TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} + local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} + _ = IndLight{parent=clr_c_2,x=21,y=9,label="Warning",colors=cpair(colors.black,colors.yellow)} + _ = IndLight{parent=clr_c_2,x=21,y=10,label="Bad",colors=cpair(colors.black,colors.red)} + local b_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.black,colors.black),hidden=true} + local g_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.gray,colors.gray),hidden=true} local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == 1 then + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end else term.setPaletteColor(colors.green, c[1].hex) term.setPaletteColor(colors.yellow, c[2].hex) term.setPaletteColor(colors.red, c[3].hex) end + + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then + b_off.hide() + g_off.show() + else + g_off.hide() + b_off.show() + end end - TextBox{parent=clr_c_2,x=1,y=8,height=1,text="Color Mode"} - local c_mode = RadioButton{parent=clr_c_2,x=1,y=9,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} + TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} + local c_mode = RadioButton{parent=clr_c_2,x=1,y=8,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=20,y=8,height=1,text="Preview"} - local _ = IndLight{parent=clr_c_2,x=20,y=9,label="Good",colors=cpair(colors.black,colors.green)} - _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} - _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - - TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=21,y=13,height=2,width=18,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/coordinator/ui/style.lua b/coordinator/ui/style.lua index cec21d6..1b10106 100644 --- a/coordinator/ui/style.lua +++ b/coordinator/ui/style.lua @@ -88,8 +88,8 @@ style.theme = smooth_stone ---@param fp FP_THEME front panel theme ---@param color_mode COLOR_MODE the color mode to use function style.set_themes(main, fp, color_mode) - local colorblind = color_mode ~= themes.COLOR_MODE.STANDARD - local black_ind_off = colorblind and (color_mode ~= themes.COLOR_MODE.BLUE_IND) + local colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) + local black_ind_off = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND style.ind_bkg = colors.gray style.ind_hi_box_bg = util.trinary(black_ind_off, colors.black, colors.gray) diff --git a/graphics/themes.lua b/graphics/themes.lua index e7bf00f..7d20a60 100644 --- a/graphics/themes.lua +++ b/graphics/themes.lua @@ -56,8 +56,9 @@ themes.COLOR_MODE = { PROTANOPIA = 3, TRITANOPIA = 4, BLUE_IND = 5, - BLUE_ON_BLACK = 6, - NUM_MODES = 6 + STD_ON_BLACK = 6, + BLUE_ON_BLACK = 7, + NUM_MODES = 8 } themes.COLOR_MODE_NAMES = { @@ -65,8 +66,9 @@ themes.COLOR_MODE_NAMES = { "Deuteranopia", "Protanopia", "Tritanopia", - "Blue Standard", - "Blue + Black Off" + "Blue for 'Good'", + "Standard + Black", + "Blue + Black" } -- attempts to get the string name of a color mode @@ -79,6 +81,7 @@ function themes.color_mode_name(id) id == themes.COLOR_MODE.PROTANOPIA or id == themes.COLOR_MODE.TRITANOPIA or id == themes.COLOR_MODE.BLUE_IND or + id == themes.COLOR_MODE.STD_ON_BLACK or id == themes.COLOR_MODE.BLUE_ON_BLACK then return themes.COLOR_MODE_NAMES[id] else return nil end @@ -161,6 +164,12 @@ themes.sandstone = { { c = colors.green_hc, hex = 0x1081ff }, { c = colors.green_off, hex = 0x053466 }, }, + -- standard, black backgrounds + { + { c = colors.green_off, hex = 0x141414 }, + { c = colors.yellow_off, hex = 0x141414 }, + { c = colors.red_off, hex = 0x141414 } + }, -- blue indicators, black backgrounds { { c = colors.green, hex = 0x1081ff }, @@ -244,6 +253,12 @@ themes.basalt = { { c = colors.green_hc, hex = 0x99c9ff }, { c = colors.green_off, hex = 0x365e8a }, }, + -- standard, black backgrounds + { + { c = colors.green_off, hex = 0x333333 }, + { c = colors.yellow_off, hex = 0x333333 }, + { c = colors.red_off, hex = 0x333333 } + }, -- blue indicators, black backgrounds { { c = colors.green, hex = 0x65aeff }, @@ -327,6 +342,8 @@ themes.smooth_stone = { { c = colors.yellow, hex = 0xfffc79 }, { c = colors.red, hex = 0xdf4949 } }, + -- standard, black backgrounds + {}, -- blue indicators, black backgrounds { { c = colors.blue, hex = 0x1081ff }, @@ -385,6 +402,8 @@ themes.deepslate = { { c = colors.yellow, hex = 0xd9cf81 }, { c = colors.red, hex = 0xeb6a6c } }, + -- standard, black backgrounds + {}, -- blue indicators, black backgrounds { { c = colors.blue, hex = 0x65aeff }, diff --git a/reactor-plc/configure.lua b/reactor-plc/configure.lua index 018df10..9a8ece1 100644 --- a/reactor-plc/configure.lua +++ b/reactor-plc/configure.lua @@ -463,29 +463,39 @@ local function config_view(display) TextBox{parent=clr_c_1,x=1,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=1,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color blindness below, blues will be used instead of greens on indicators and multi-color indicators will be split up as space permits."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + + TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} + local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} + _ = IndLight{parent=clr_c_2,x=21,y=9,label="Warning",colors=cpair(colors.black,colors.yellow)} + _ = IndLight{parent=clr_c_2,x=21,y=10,label="Bad",colors=cpair(colors.black,colors.red)} + local b_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.black,colors.black),hidden=true} + local g_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.gray,colors.gray),hidden=true} local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == 1 then + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end else term.setPaletteColor(colors.green, c[1].hex) term.setPaletteColor(colors.yellow, c[2].hex) term.setPaletteColor(colors.red, c[3].hex) end + + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then + b_off.hide() + g_off.show() + else + g_off.hide() + b_off.show() + end end - TextBox{parent=clr_c_2,x=1,y=8,height=1,text="Color Mode"} - local c_mode = RadioButton{parent=clr_c_2,x=1,y=9,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} + TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} + local c_mode = RadioButton{parent=clr_c_2,x=1,y=8,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=20,y=8,height=1,text="Preview"} - local _ = IndLight{parent=clr_c_2,x=20,y=9,label="Good",colors=cpair(colors.black,colors.green)} - _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} - _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - - TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=21,y=13,height=2,width=18,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/reactor-plc/panel/style.lua b/reactor-plc/panel/style.lua index 7f5661f..61302ae 100644 --- a/reactor-plc/panel/style.lua +++ b/reactor-plc/panel/style.lua @@ -31,9 +31,9 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) - style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD + style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) - style.ind_bkg = util.trinary(style.colorblind and (color_mode ~= themes.COLOR_MODE.BLUE_IND), colors.black, colors.gray) + style.ind_bkg = util.trinary(color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND, colors.black, colors.gray) end return style diff --git a/rtu/configure.lua b/rtu/configure.lua index dc78fa9..fe02d8e 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -518,29 +518,39 @@ local function config_view(display) TextBox{parent=clr_c_1,x=1,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=1,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color blindness below, blues will be used instead of greens on indicators and multi-color indicators will be split up as space permits."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + + TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} + local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} + _ = IndLight{parent=clr_c_2,x=21,y=9,label="Warning",colors=cpair(colors.black,colors.yellow)} + _ = IndLight{parent=clr_c_2,x=21,y=10,label="Bad",colors=cpair(colors.black,colors.red)} + local b_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.black,colors.black),hidden=true} + local g_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.gray,colors.gray),hidden=true} local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == 1 then + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end else term.setPaletteColor(colors.green, c[1].hex) term.setPaletteColor(colors.yellow, c[2].hex) term.setPaletteColor(colors.red, c[3].hex) end + + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then + b_off.hide() + g_off.show() + else + g_off.hide() + b_off.show() + end end - TextBox{parent=clr_c_2,x=1,y=8,height=1,text="Color Mode"} - local c_mode = RadioButton{parent=clr_c_2,x=1,y=9,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} + TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} + local c_mode = RadioButton{parent=clr_c_2,x=1,y=8,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=20,y=8,height=1,text="Preview"} - local _ = IndLight{parent=clr_c_2,x=20,y=9,label="Good",colors=cpair(colors.black,colors.green)} - _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} - _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - - TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=21,y=13,height=2,width=18,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/rtu/panel/style.lua b/rtu/panel/style.lua index fd5eaf4..a815c3e 100644 --- a/rtu/panel/style.lua +++ b/rtu/panel/style.lua @@ -30,9 +30,9 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) - style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD + style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) - style.ind_bkg = util.trinary(style.colorblind and (color_mode ~= themes.COLOR_MODE.BLUE_IND), colors.black, colors.gray) + style.ind_bkg = util.trinary(color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND, colors.black, colors.gray) end return style diff --git a/supervisor/configure.lua b/supervisor/configure.lua index 130ff5c..86d4805 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -762,29 +762,39 @@ local function config_view(display) TextBox{parent=clr_c_1,x=1,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=1,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color blindness below, blues will be used instead of greens on indicators and multi-color indicators will be split up as space permits."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + + TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} + local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} + _ = IndLight{parent=clr_c_2,x=21,y=9,label="Warning",colors=cpair(colors.black,colors.yellow)} + _ = IndLight{parent=clr_c_2,x=21,y=10,label="Bad",colors=cpair(colors.black,colors.red)} + local b_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.black,colors.black),hidden=true} + local g_off = IndLight{parent=clr_c_2,x=21,y=11,label="Off",colors=cpair(colors.gray,colors.gray),hidden=true} local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == 1 then + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end else term.setPaletteColor(colors.green, c[1].hex) term.setPaletteColor(colors.yellow, c[2].hex) term.setPaletteColor(colors.red, c[3].hex) end + + if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then + b_off.hide() + g_off.show() + else + g_off.hide() + b_off.show() + end end - TextBox{parent=clr_c_2,x=1,y=8,height=1,text="Color Mode"} - local c_mode = RadioButton{parent=clr_c_2,x=1,y=9,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} + TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} + local c_mode = RadioButton{parent=clr_c_2,x=1,y=8,default=ini_cfg.ColorMode,options=themes.COLOR_MODE_NAMES,callback=recolor,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=20,y=8,height=1,text="Preview"} - local _ = IndLight{parent=clr_c_2,x=20,y=9,label="Good",colors=cpair(colors.black,colors.green)} - _ = IndLight{parent=clr_c_2,x=20,y=10,label="Warning",colors=cpair(colors.black,colors.yellow)} - _ = IndLight{parent=clr_c_2,x=20,y=11,label="Bad",colors=cpair(colors.black,colors.red)} - - TextBox{parent=clr_c_2,x=20,y=13,height=2,width=23,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} + TextBox{parent=clr_c_2,x=21,y=13,height=2,width=18,text="Note: exact color varies by theme.",fg_bg=g_lg_fg_bg} PushButton{parent=clr_c_2,x=44,y=14,min_width=6,text="Done",callback=function()clr_pane.set_value(1)end,fg_bg=nav_fg_bg,active_fg_bg=btn_act_fg_bg} diff --git a/supervisor/panel/style.lua b/supervisor/panel/style.lua index a0a8bb0..083d9ce 100644 --- a/supervisor/panel/style.lua +++ b/supervisor/panel/style.lua @@ -28,7 +28,7 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) - style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD + style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) end return style From e1ad76a00d032d7ba0c2ef0cb1ed43e08c20a716 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 24 Mar 2024 13:56:19 -0400 Subject: [PATCH 4/6] #457 fixes and adjusted text --- coordinator/configure.lua | 18 +++++++++--------- reactor-plc/configure.lua | 18 +++++++++--------- rtu/configure.lua | 18 +++++++++--------- supervisor/configure.lua | 18 +++++++++--------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/coordinator/configure.lua b/coordinator/configure.lua index c85346a..6ddec1b 100644 --- a/coordinator/configure.lua +++ b/coordinator/configure.lua @@ -825,7 +825,7 @@ local function config_view(display) TextBox{parent=clr_c_1,x=18,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=18,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="This system uses color heavily to distinguish ok and not, with some indicators using many colors. By selecting a mode below, indicators will change as shown. For non-standard modes, indicators with more than two colors will be split up."} TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} @@ -837,14 +837,6 @@ local function config_view(display) local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then - for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end - else - term.setPaletteColor(colors.green, c[1].hex) - term.setPaletteColor(colors.yellow, c[2].hex) - term.setPaletteColor(colors.red, c[3].hex) - end - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then b_off.hide() g_off.show() @@ -852,6 +844,14 @@ local function config_view(display) g_off.hide() b_off.show() end + + if #c == 0 then + for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end + else + term.setPaletteColor(colors.green, c[1].hex) + term.setPaletteColor(colors.yellow, c[2].hex) + term.setPaletteColor(colors.red, c[3].hex) + end end TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} diff --git a/reactor-plc/configure.lua b/reactor-plc/configure.lua index 9a8ece1..ac80b25 100644 --- a/reactor-plc/configure.lua +++ b/reactor-plc/configure.lua @@ -463,7 +463,7 @@ local function config_view(display) TextBox{parent=clr_c_1,x=1,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=1,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="This system uses color heavily to distinguish ok and not, with some indicators using many colors. By selecting a mode below, indicators will change as shown. For non-standard modes, indicators with more than two colors will be split up."} TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} @@ -475,14 +475,6 @@ local function config_view(display) local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then - for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end - else - term.setPaletteColor(colors.green, c[1].hex) - term.setPaletteColor(colors.yellow, c[2].hex) - term.setPaletteColor(colors.red, c[3].hex) - end - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then b_off.hide() g_off.show() @@ -490,6 +482,14 @@ local function config_view(display) g_off.hide() b_off.show() end + + if #c == 0 then + for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end + else + term.setPaletteColor(colors.green, c[1].hex) + term.setPaletteColor(colors.yellow, c[2].hex) + term.setPaletteColor(colors.red, c[3].hex) + end end TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} diff --git a/rtu/configure.lua b/rtu/configure.lua index fe02d8e..38735c5 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -518,7 +518,7 @@ local function config_view(display) TextBox{parent=clr_c_1,x=1,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=1,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="This system uses color heavily to distinguish ok and not, with some indicators using many colors. By selecting a mode below, indicators will change as shown. For non-standard modes, indicators with more than two colors will be split up."} TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} @@ -530,14 +530,6 @@ local function config_view(display) local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then - for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end - else - term.setPaletteColor(colors.green, c[1].hex) - term.setPaletteColor(colors.yellow, c[2].hex) - term.setPaletteColor(colors.red, c[3].hex) - end - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then b_off.hide() g_off.show() @@ -545,6 +537,14 @@ local function config_view(display) g_off.hide() b_off.show() end + + if #c == 0 then + for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end + else + term.setPaletteColor(colors.green, c[1].hex) + term.setPaletteColor(colors.yellow, c[2].hex) + term.setPaletteColor(colors.red, c[3].hex) + end end TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} diff --git a/supervisor/configure.lua b/supervisor/configure.lua index 86d4805..0b278d6 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -762,7 +762,7 @@ local function config_view(display) TextBox{parent=clr_c_1,x=1,y=7,height=1,text="Front Panel Theme"} local fp_theme = RadioButton{parent=clr_c_1,x=1,y=8,default=ini_cfg.FrontPanelTheme,options=themes.FP_THEME_NAMES,callback=function()end,radio_colors=cpair(colors.lightGray,colors.black),select_color=colors.magenta} - TextBox{parent=clr_c_2,x=1,y=1,height=6,text="By default, this project uses green/red heavily to distinguish ok and not, with some indicators also using multiple colors. By selecting a color mode below, indicators will change as shown and multi-color ones will be split up where possible."} + TextBox{parent=clr_c_2,x=1,y=1,height=6,text="This system uses color heavily to distinguish ok and not, with some indicators using many colors. By selecting a mode below, indicators will change as shown. For non-standard modes, indicators with more than two colors will be split up."} TextBox{parent=clr_c_2,x=21,y=7,height=1,text="Preview"} local _ = IndLight{parent=clr_c_2,x=21,y=8,label="Good",colors=cpair(colors.black,colors.green)} @@ -774,14 +774,6 @@ local function config_view(display) local function recolor(value) local c = themes.smooth_stone.color_modes[value] - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.STD_ON_BLACK then - for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end - else - term.setPaletteColor(colors.green, c[1].hex) - term.setPaletteColor(colors.yellow, c[2].hex) - term.setPaletteColor(colors.red, c[3].hex) - end - if value == themes.COLOR_MODE.STANDARD or value == themes.COLOR_MODE.BLUE_IND then b_off.hide() g_off.show() @@ -789,6 +781,14 @@ local function config_view(display) g_off.hide() b_off.show() end + + if #c == 0 then + for i = 1, #style.colors do term.setPaletteColor(style.colors[i].c, style.colors[i].hex) end + else + term.setPaletteColor(colors.green, c[1].hex) + term.setPaletteColor(colors.yellow, c[2].hex) + term.setPaletteColor(colors.red, c[3].hex) + end end TextBox{parent=clr_c_2,x=1,y=7,height=1,width=10,text="Color Mode"} From 55e4e5a68b21d24d372a2cfed3b8851364608516 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 24 Mar 2024 23:05:52 -0400 Subject: [PATCH 5/6] #457 fix for indicator background --- coordinator/ui/layout/front_panel.lua | 6 +++--- coordinator/ui/style.lua | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/coordinator/ui/layout/front_panel.lua b/coordinator/ui/layout/front_panel.lua index d23712b..7124083 100644 --- a/coordinator/ui/layout/front_panel.lua +++ b/coordinator/ui/layout/front_panel.lua @@ -61,12 +61,12 @@ local function init(panel, num_units) local modem = LED{parent=system,label="MODEM",colors=led_grn} if not style.colorblind then - local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.ind_bkg}} + local network = RGBLED{parent=system,label="NETWORK",colors={colors.green,colors.red,colors.orange,colors.yellow,style.fp_ind_bkg}} network.update(types.PANEL_LINK_STATE.DISCONNECTED) network.register(ps, "link_state", network.update) else - local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=style.ind_bkg,c1=colors.red,c2=colors.green} - local nt_ver = LEDPair{parent=system,label="NT VERSION",off=style.ind_bkg,c1=colors.red,c2=colors.green} + local nt_lnk = LEDPair{parent=system,label="NT LINKED",off=style.fp_ind_bkg,c1=colors.red,c2=colors.green} + local nt_ver = LEDPair{parent=system,label="NT VERSION",off=style.fp_ind_bkg,c1=colors.red,c2=colors.green} nt_lnk.register(ps, "link_state", function (state) local value = 2 diff --git a/coordinator/ui/style.lua b/coordinator/ui/style.lua index 1b10106..471f5b7 100644 --- a/coordinator/ui/style.lua +++ b/coordinator/ui/style.lua @@ -92,6 +92,7 @@ function style.set_themes(main, fp, color_mode) local black_ind_off = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND style.ind_bkg = colors.gray + style.fp_ind_bkg = util.trinary(black_ind_off, colors.black, colors.gray) style.ind_hi_box_bg = util.trinary(black_ind_off, colors.black, colors.gray) if main == themes.UI_THEME.SMOOTH_STONE then From b94c89f4ecae212a385e699388413f58a2b010fd Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Mon, 25 Mar 2024 10:11:35 -0400 Subject: [PATCH 6/6] #457 cleanup --- coordinator/configure.lua | 2 +- coordinator/ui/style.lua | 12 ++++++------ reactor-plc/configure.lua | 2 +- reactor-plc/panel/style.lua | 10 ++++++---- rtu/configure.lua | 2 +- rtu/panel/style.lua | 10 ++++++---- supervisor/configure.lua | 2 +- supervisor/panel/style.lua | 2 +- 8 files changed, 23 insertions(+), 19 deletions(-) diff --git a/coordinator/configure.lua b/coordinator/configure.lua index 6ddec1b..c67e7ba 100644 --- a/coordinator/configure.lua +++ b/coordinator/configure.lua @@ -45,7 +45,7 @@ local RIGHT = core.ALIGN.RIGHT local changes = { { "v1.2.4", { "Added temperature scale options" } }, { "v1.2.12", { "Added main UI theme", "Added front panel UI theme", "Added color accessibility modes" } }, - { "v1.3.3", { "Added blue indicators color mode" } } + { "v1.3.3", { "Added standard with black off state color mode", "Added blue indicator color modes" } } } ---@class crd_configurator diff --git a/coordinator/ui/style.lua b/coordinator/ui/style.lua index 471f5b7..306fe2e 100644 --- a/coordinator/ui/style.lua +++ b/coordinator/ui/style.lua @@ -88,19 +88,19 @@ style.theme = smooth_stone ---@param fp FP_THEME front panel theme ---@param color_mode COLOR_MODE the color mode to use function style.set_themes(main, fp, color_mode) - local colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) - local black_ind_off = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND + local colorblind = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.STD_ON_BLACK + local gray_ind_off = color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.BLUE_IND style.ind_bkg = colors.gray - style.fp_ind_bkg = util.trinary(black_ind_off, colors.black, colors.gray) - style.ind_hi_box_bg = util.trinary(black_ind_off, colors.black, colors.gray) + style.fp_ind_bkg = util.trinary(gray_ind_off, colors.gray, colors.black) + style.ind_hi_box_bg = util.trinary(gray_ind_off, colors.gray, colors.black) if main == themes.UI_THEME.SMOOTH_STONE then style.theme = smooth_stone - style.ind_bkg = util.trinary(black_ind_off, colors.black, colors.gray) + style.ind_bkg = util.trinary(gray_ind_off, colors.gray, colors.black) elseif main == themes.UI_THEME.DEEPSLATE then style.theme = deepslate - style.ind_hi_box_bg = util.trinary(black_ind_off, colors.black, colors.lightGray) + style.ind_hi_box_bg = util.trinary(gray_ind_off, colors.lightGray, colors.black) end style.colorblind = colorblind diff --git a/reactor-plc/configure.lua b/reactor-plc/configure.lua index ac80b25..ea9036c 100644 --- a/reactor-plc/configure.lua +++ b/reactor-plc/configure.lua @@ -40,7 +40,7 @@ local changes = { { "v1.6.2", { "AuthKey minimum length is now 8 (if set)" } }, { "v1.6.8", { "ConnTimeout can now have a fractional part" } }, { "v1.6.15", { "Added front panel UI theme", "Added color accessibility modes" } }, - { "v1.7.3", { "Added blue indicators color mode" } } + { "v1.7.3", { "Added standard with black off state color mode", "Added blue indicator color modes" } } } ---@class plc_configurator diff --git a/reactor-plc/panel/style.lua b/reactor-plc/panel/style.lua index 61302ae..c170d67 100644 --- a/reactor-plc/panel/style.lua +++ b/reactor-plc/panel/style.lua @@ -2,8 +2,6 @@ -- Graphics Style Options -- -local util = require("scada-common.util") - local core = require("graphics.core") local themes = require("graphics.themes") @@ -31,9 +29,13 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) - style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) + style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.STD_ON_BLACK - style.ind_bkg = util.trinary(color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND, colors.black, colors.gray) + if color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.BLUE_IND then + style.ind_bkg = colors.gray + else + style.ind_bkg = colors.black + end end return style diff --git a/rtu/configure.lua b/rtu/configure.lua index 38735c5..84ce37b 100644 --- a/rtu/configure.lua +++ b/rtu/configure.lua @@ -78,7 +78,7 @@ assert(#PORT_DSGN == rsio.NUM_PORTS) local changes = { { "v1.7.9", { "ConnTimeout can now have a fractional part" } }, { "v1.7.15", { "Added front panel UI theme", "Added color accessibility modes" } }, - { "v1.9.2", { "Added blue indicators color mode" } } + { "v1.9.2", { "Added standard with black off state color mode", "Added blue indicator color modes" } } } ---@class rtu_rs_definition diff --git a/rtu/panel/style.lua b/rtu/panel/style.lua index a815c3e..89dc302 100644 --- a/rtu/panel/style.lua +++ b/rtu/panel/style.lua @@ -2,8 +2,6 @@ -- Graphics Style Options -- -local util = require("scada-common.util") - local core = require("graphics.core") local themes = require("graphics.themes") @@ -30,9 +28,13 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) - style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) + style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.STD_ON_BLACK - style.ind_bkg = util.trinary(color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND, colors.black, colors.gray) + if color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.BLUE_IND then + style.ind_bkg = colors.gray + else + style.ind_bkg = colors.black + end end return style diff --git a/supervisor/configure.lua b/supervisor/configure.lua index 0b278d6..94866fb 100644 --- a/supervisor/configure.lua +++ b/supervisor/configure.lua @@ -37,7 +37,7 @@ local RIGHT = core.ALIGN.RIGHT -- changes to the config data/format to let the user know local changes = { { "v1.2.12", { "Added front panel UI theme", "Added color accessibility modes" } }, - { "v1.3.2", { "Added blue indicators color mode" } } + { "v1.3.2", { "Added standard with black off state color mode", "Added blue indicator color modes" } } } ---@class svr_configurator diff --git a/supervisor/panel/style.lua b/supervisor/panel/style.lua index 083d9ce..f8c9311 100644 --- a/supervisor/panel/style.lua +++ b/supervisor/panel/style.lua @@ -28,7 +28,7 @@ function style.set_theme(fp, color_mode) style.fp = themes.get_fp_style(style.theme) - style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK) + style.colorblind = color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.STD_ON_BLACK end return style