2023-02-28 04:59:46 +00:00
|
|
|
--
|
|
|
|
-- Graphics Style Options
|
|
|
|
--
|
2022-06-14 16:02:42 +00:00
|
|
|
|
2024-03-12 03:31:31 +00:00
|
|
|
local util = require("scada-common.util")
|
|
|
|
|
2024-03-06 16:43:31 +00:00
|
|
|
local core = require("graphics.core")
|
|
|
|
local themes = require("graphics.themes")
|
2022-06-14 16:02:42 +00:00
|
|
|
|
2024-02-24 19:35:04 +00:00
|
|
|
---@class crd_style
|
2022-06-14 16:02:42 +00:00
|
|
|
local style = {}
|
|
|
|
|
2023-05-07 01:27:36 +00:00
|
|
|
local cpair = core.cpair
|
2022-06-16 15:24:35 +00:00
|
|
|
|
2023-07-10 03:31:56 +00:00
|
|
|
-- front panel styling
|
|
|
|
|
2024-03-06 16:43:31 +00:00
|
|
|
style.fp_theme = themes.sandstone
|
|
|
|
style.fp = themes.get_fp_style(style.fp_theme)
|
|
|
|
|
|
|
|
style.led_grn = cpair(colors.green, colors.green_off)
|
2023-07-10 03:31:56 +00:00
|
|
|
|
|
|
|
-- main GUI styling
|
|
|
|
|
2024-02-24 19:35:04 +00:00
|
|
|
---@class theme
|
|
|
|
local smooth_stone = {
|
|
|
|
text = colors.black,
|
|
|
|
text_inv = colors.white,
|
|
|
|
label = colors.gray,
|
2024-02-24 22:35:10 +00:00
|
|
|
label_dark = colors.gray,
|
2024-02-24 19:35:04 +00:00
|
|
|
disabled = colors.lightGray,
|
|
|
|
bg = colors.lightGray,
|
2024-03-12 03:31:31 +00:00
|
|
|
checkbox_bg = colors.black,
|
2024-02-24 19:35:04 +00:00
|
|
|
accent_light = colors.white,
|
|
|
|
accent_dark = colors.gray,
|
|
|
|
|
|
|
|
fuel_color = colors.black,
|
|
|
|
|
|
|
|
header = cpair(colors.white, colors.gray),
|
|
|
|
|
|
|
|
text_fg = cpair(colors.black, colors._INHERIT),
|
|
|
|
label_fg = cpair(colors.gray, colors._INHERIT),
|
|
|
|
disabled_fg = cpair(colors.lightGray, colors._INHERIT),
|
|
|
|
|
|
|
|
highlight_box = cpair(colors.black, colors.white),
|
2024-02-24 20:37:39 +00:00
|
|
|
highlight_box_bright = cpair(colors.black, colors.white),
|
2024-02-24 19:35:04 +00:00
|
|
|
field_box = cpair(colors.black, colors.white),
|
|
|
|
|
2024-03-12 03:54:03 +00:00
|
|
|
colors = themes.smooth_stone.colors,
|
2024-03-12 03:31:31 +00:00
|
|
|
|
|
|
|
-- color re-mappings for assistive modes
|
2024-03-12 03:54:03 +00:00
|
|
|
color_modes = themes.smooth_stone.color_modes
|
2022-07-05 16:46:31 +00:00
|
|
|
}
|
|
|
|
|
2024-03-06 16:43:31 +00:00
|
|
|
---@type theme
|
|
|
|
local deepslate = {
|
|
|
|
text = colors.white,
|
|
|
|
text_inv = colors.black,
|
|
|
|
label = colors.lightGray,
|
|
|
|
label_dark = colors.gray,
|
|
|
|
disabled = colors.gray,
|
|
|
|
bg = colors.black,
|
2024-03-12 03:31:31 +00:00
|
|
|
checkbox_bg = colors.gray,
|
2024-03-06 16:43:31 +00:00
|
|
|
accent_light = colors.gray,
|
|
|
|
accent_dark = colors.lightGray,
|
|
|
|
|
|
|
|
fuel_color = colors.lightGray,
|
|
|
|
|
|
|
|
header = cpair(colors.white, colors.gray),
|
|
|
|
|
|
|
|
text_fg = cpair(colors.white, colors._INHERIT),
|
|
|
|
label_fg = cpair(colors.lightGray, colors._INHERIT),
|
|
|
|
disabled_fg = cpair(colors.gray, colors._INHERIT),
|
|
|
|
|
|
|
|
highlight_box = cpair(colors.white, colors.gray),
|
|
|
|
highlight_box_bright = cpair(colors.black, colors.lightGray),
|
|
|
|
field_box = cpair(colors.white, colors.gray),
|
|
|
|
|
2024-03-12 03:54:03 +00:00
|
|
|
colors = themes.deepslate.colors,
|
2024-03-12 03:31:31 +00:00
|
|
|
|
|
|
|
-- color re-mappings for assistive modes
|
2024-03-12 03:54:03 +00:00
|
|
|
color_modes = themes.deepslate.color_modes
|
2024-03-06 16:43:31 +00:00
|
|
|
}
|
|
|
|
|
2024-03-07 04:35:30 +00:00
|
|
|
style.theme = smooth_stone
|
2024-02-24 19:35:04 +00:00
|
|
|
|
2024-03-07 04:35:30 +00:00
|
|
|
-- set themes per configurations
|
2024-03-12 16:24:32 +00:00
|
|
|
---@param main UI_THEME main UI theme
|
|
|
|
---@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)
|
2024-03-25 14:11:35 +00:00
|
|
|
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
|
2024-03-12 03:31:31 +00:00
|
|
|
|
2024-03-12 16:24:32 +00:00
|
|
|
style.ind_bkg = colors.gray
|
2024-03-25 14:11:35 +00:00
|
|
|
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)
|
2024-03-12 03:31:31 +00:00
|
|
|
|
|
|
|
if main == themes.UI_THEME.SMOOTH_STONE then
|
2024-03-07 04:35:30 +00:00
|
|
|
style.theme = smooth_stone
|
2024-03-25 14:11:35 +00:00
|
|
|
style.ind_bkg = util.trinary(gray_ind_off, colors.gray, colors.black)
|
2024-03-12 03:31:31 +00:00
|
|
|
elseif main == themes.UI_THEME.DEEPSLATE then
|
2024-03-07 04:35:30 +00:00
|
|
|
style.theme = deepslate
|
2024-03-25 14:11:35 +00:00
|
|
|
style.ind_hi_box_bg = util.trinary(gray_ind_off, colors.lightGray, colors.black)
|
2024-03-07 04:35:30 +00:00
|
|
|
end
|
|
|
|
|
2024-03-12 16:24:32 +00:00
|
|
|
style.colorblind = colorblind
|
|
|
|
|
2024-03-07 04:35:30 +00:00
|
|
|
style.root = cpair(style.theme.text, style.theme.bg)
|
|
|
|
style.label = cpair(style.theme.label, style.theme.bg)
|
|
|
|
|
2024-03-12 03:31:31 +00:00
|
|
|
-- high contrast text (also tags)
|
2024-03-07 04:35:30 +00:00
|
|
|
style.hc_text = cpair(style.theme.text, style.theme.text_inv)
|
2024-03-12 03:31:31 +00:00
|
|
|
-- text on default background
|
2024-03-07 04:35:30 +00:00
|
|
|
style.text_colors = cpair(style.theme.text, style.theme.bg)
|
2024-03-12 03:31:31 +00:00
|
|
|
-- label & unit colors
|
2024-03-07 04:35:30 +00:00
|
|
|
style.lu_colors = cpair(style.theme.label, style.theme.label)
|
2024-03-12 03:31:31 +00:00
|
|
|
-- label & unit colors (darker if set)
|
2024-03-07 04:35:30 +00:00
|
|
|
style.lu_colors_dark = cpair(style.theme.label_dark, style.theme.label_dark)
|
|
|
|
|
2024-03-12 03:31:31 +00:00
|
|
|
style.ind_grn = cpair(util.trinary(colorblind, colors.blue, colors.green), style.ind_bkg)
|
|
|
|
style.ind_yel = cpair(colors.yellow, style.ind_bkg)
|
|
|
|
style.ind_red = cpair(colors.red, style.ind_bkg)
|
|
|
|
style.ind_wht = cpair(colors.white, style.ind_bkg)
|
|
|
|
|
|
|
|
if fp == themes.FP_THEME.SANDSTONE then
|
2024-03-07 04:35:30 +00:00
|
|
|
style.fp_theme = themes.sandstone
|
2024-03-12 03:31:31 +00:00
|
|
|
elseif fp == themes.FP_THEME.BASALT then
|
2024-03-07 04:35:30 +00:00
|
|
|
style.fp_theme = themes.basalt
|
|
|
|
end
|
|
|
|
|
|
|
|
style.fp = themes.get_fp_style(style.fp_theme)
|
|
|
|
end
|
|
|
|
|
2023-08-13 04:51:37 +00:00
|
|
|
-- COMMON COLOR PAIRS --
|
|
|
|
|
2023-08-20 20:52:12 +00:00
|
|
|
style.wh_gray = cpair(colors.white, colors.gray)
|
|
|
|
|
2023-08-13 04:51:37 +00:00
|
|
|
style.bw_fg_bg = cpair(colors.black, colors.white)
|
2024-02-24 20:37:39 +00:00
|
|
|
|
2023-08-20 20:52:12 +00:00
|
|
|
style.hzd_fg_bg = style.wh_gray
|
2023-08-13 04:51:37 +00:00
|
|
|
style.dis_colors = cpair(colors.white, colors.lightGray)
|
|
|
|
|
2023-09-02 02:24:31 +00:00
|
|
|
style.lg_gray = cpair(colors.lightGray, colors.gray)
|
|
|
|
style.lg_white = cpair(colors.lightGray, colors.white)
|
|
|
|
style.gray_white = cpair(colors.gray, colors.white)
|
|
|
|
|
2023-08-13 04:51:37 +00:00
|
|
|
-- UI COMPONENTS --
|
2022-07-05 16:46:31 +00:00
|
|
|
|
2022-06-16 15:24:35 +00:00
|
|
|
style.reactor = {
|
|
|
|
-- reactor states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
2022-09-13 20:08:11 +00:00
|
|
|
text = "PLC OFF-LINE"
|
2022-06-16 15:24:35 +00:00
|
|
|
},
|
2022-12-10 18:58:17 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "NOT FORMED"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "PLC FAULT"
|
|
|
|
},
|
2022-06-16 15:24:35 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.white, colors.gray),
|
|
|
|
text = "DISABLED"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "ACTIVE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.red),
|
2022-09-13 20:08:11 +00:00
|
|
|
text = "SCRAMMED"
|
2022-09-03 17:10:51 +00:00
|
|
|
},
|
2022-11-11 20:45:46 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.red),
|
|
|
|
text = "FORCE DISABLED"
|
2022-06-16 15:24:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-14 16:02:42 +00:00
|
|
|
|
2022-06-25 20:21:57 +00:00
|
|
|
style.boiler = {
|
|
|
|
-- boiler states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "OFF-LINE"
|
|
|
|
},
|
2022-11-11 19:59:53 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
2023-02-13 23:53:24 +00:00
|
|
|
text = "NOT FORMED"
|
2022-11-11 19:59:53 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
2023-02-13 23:53:24 +00:00
|
|
|
text = "RTU FAULT"
|
2022-12-10 18:58:17 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.white, colors.gray),
|
|
|
|
text = "IDLE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "ACTIVE"
|
2022-06-25 20:21:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-02 21:24:52 +00:00
|
|
|
style.turbine = {
|
|
|
|
-- turbine states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "OFF-LINE"
|
|
|
|
},
|
2022-12-10 18:58:17 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "NOT FORMED"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "RTU FAULT"
|
|
|
|
},
|
2022-07-02 21:24:52 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.white, colors.gray),
|
|
|
|
text = "IDLE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "ACTIVE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.red),
|
|
|
|
text = "TRIP"
|
2022-12-10 18:58:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
style.imatrix = {
|
|
|
|
-- induction matrix states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "OFF-LINE"
|
2022-11-11 19:59:53 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
2022-12-10 18:58:17 +00:00
|
|
|
text = "NOT FORMED"
|
2022-11-11 19:59:53 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
2022-12-10 18:58:17 +00:00
|
|
|
text = "RTU FAULT"
|
|
|
|
},
|
|
|
|
{
|
2022-12-10 20:44:11 +00:00
|
|
|
color = cpair(colors.black, colors.green),
|
2022-12-10 18:58:17 +00:00
|
|
|
text = "ONLINE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "LOW CHARGE"
|
|
|
|
},
|
|
|
|
{
|
2023-03-05 16:52:03 +00:00
|
|
|
color = cpair(colors.black, colors.yellow),
|
2022-12-10 18:58:17 +00:00
|
|
|
text = "HIGH CHARGE"
|
2023-07-06 05:36:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-08 20:57:13 +00:00
|
|
|
style.sps = {
|
|
|
|
-- SPS states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "OFF-LINE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "NOT FORMED"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "RTU FAULT"
|
|
|
|
},
|
|
|
|
{
|
2023-08-20 00:06:37 +00:00
|
|
|
color = cpair(colors.white, colors.gray),
|
2023-07-08 20:57:13 +00:00
|
|
|
text = "IDLE"
|
|
|
|
},
|
|
|
|
{
|
2023-08-20 00:06:37 +00:00
|
|
|
color = cpair(colors.black, colors.green),
|
2023-07-08 20:57:13 +00:00
|
|
|
text = "ACTIVE"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-13 04:11:58 +00:00
|
|
|
style.dtank = {
|
|
|
|
-- dynamic tank states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "OFF-LINE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "NOT FORMED"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.orange),
|
|
|
|
text = "RTU FAULT"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "ONLINE"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.yellow),
|
|
|
|
text = "LOW FILL"
|
2023-08-20 00:06:37 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "FILLED"
|
|
|
|
},
|
2023-08-13 04:11:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-06 05:36:06 +00:00
|
|
|
style.waste = {
|
|
|
|
-- auto waste processing states
|
|
|
|
states = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "PLUTONIUM"
|
2022-12-10 18:58:17 +00:00
|
|
|
},
|
2023-07-06 05:36:06 +00:00
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.cyan),
|
|
|
|
text = "POLONIUM"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.purple),
|
|
|
|
text = "ANTI MATTER"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
states_abbrv = {
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.green),
|
|
|
|
text = "Pu"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.cyan),
|
|
|
|
text = "Po"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
color = cpair(colors.black, colors.purple),
|
|
|
|
text = "AM"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
-- process radio button options
|
|
|
|
options = { "Plutonium", "Polonium", "Antimatter" },
|
|
|
|
-- unit waste selection
|
|
|
|
unit_opts = {
|
|
|
|
{
|
|
|
|
text = "Auto",
|
|
|
|
fg_bg = cpair(colors.black, colors.lightGray),
|
|
|
|
active_fg_bg = cpair(colors.white, colors.gray)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text = "Pu",
|
|
|
|
fg_bg = cpair(colors.black, colors.lightGray),
|
|
|
|
active_fg_bg = cpair(colors.black, colors.green)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text = "Po",
|
|
|
|
fg_bg = cpair(colors.black, colors.lightGray),
|
|
|
|
active_fg_bg = cpair(colors.black, colors.cyan)
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text = "AM",
|
|
|
|
fg_bg = cpair(colors.black, colors.lightGray),
|
|
|
|
active_fg_bg = cpair(colors.black, colors.purple)
|
|
|
|
}
|
2022-07-02 21:24:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-14 16:02:42 +00:00
|
|
|
return style
|