From b94c89f4ecae212a385e699388413f58a2b010fd Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Mon, 25 Mar 2024 10:11:35 -0400 Subject: [PATCH] #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