cc-mek-scada/reactor-plc/panel/style.lua

40 lines
1.1 KiB
Lua
Raw Normal View History

2023-04-07 02:10:33 +00:00
--
-- Graphics Style Options
--
2024-03-24 17:03:48 +00:00
local util = require("scada-common.util")
2024-03-06 17:18:50 +00:00
local core = require("graphics.core")
local themes = require("graphics.themes")
2023-04-07 02:10:33 +00:00
2024-03-06 17:18:50 +00:00
---@class plc_style
2023-04-07 02:10:33 +00:00
local style = {}
2023-05-07 01:27:36 +00:00
local cpair = core.cpair
2023-04-07 02:10:33 +00:00
style.theme = themes.sandstone
2024-03-06 17:18:50 +00:00
style.fp = themes.get_fp_style(style.theme)
2024-03-12 16:24:32 +00:00
style.colorblind = false
style.ind_grn = cpair(colors.green, colors.green_off)
style.ind_red = cpair(colors.red, colors.red_off)
-- set theme per configuration
2024-03-12 16:24:32 +00:00
---@param fp FP_THEME front panel theme
---@param color_mode COLOR_MODE the color mode to use
function style.set_theme(fp, color_mode)
if fp == themes.FP_THEME.SANDSTONE then
style.theme = themes.sandstone
2024-03-12 16:24:32 +00:00
elseif fp == themes.FP_THEME.BASALT then
style.theme = themes.basalt
end
style.fp = themes.get_fp_style(style.theme)
2024-03-12 16:24:32 +00:00
2024-03-24 17:39:24 +00:00
style.colorblind = not (color_mode == themes.COLOR_MODE.STANDARD or color_mode == themes.COLOR_MODE.STD_ON_BLACK)
2024-03-24 17:03:48 +00:00
2024-03-24 17:39:24 +00:00
style.ind_bkg = util.trinary(color_mode ~= themes.COLOR_MODE.STANDARD and color_mode ~= themes.COLOR_MODE.BLUE_IND, colors.black, colors.gray)
end
2023-04-07 02:10:33 +00:00
return style