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