#405 #340 coordinator configurator control of theme and color mode

This commit is contained in:
Mikayla Fischler
2024-03-06 23:35:30 -05:00
parent 560061d4ad
commit 510995b04f
15 changed files with 248 additions and 78 deletions

View File

@@ -14,15 +14,15 @@ local VerticalBar = require("graphics.elements.indicators.vbar")
local cpair = core.cpair
local border = core.border
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
-- new boiler view
---@param root graphics_element parent
---@param x integer top left x
---@param y integer top left y
---@param ps psil ps interface
local function new_view(root, x, y, ps)
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
local db = iocontrol.get_db()
local boiler = Rectangle{parent=root,border=border(1,colors.gray,true),width=31,height=7,x=x,y=y}

View File

@@ -18,9 +18,6 @@ local border = core.border
local ALIGN = core.ALIGN
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
-- new induction matrix view
---@param root graphics_element parent
---@param x integer top left x
@@ -29,6 +26,9 @@ local lu_col = style.lu_colors
---@param ps psil ps interface
---@param id number? matrix ID
local function new_view(root, x, y, data, ps, id)
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
local title = "INDUCTION MATRIX"
if type(id) == "number" then title = title .. id end

View File

@@ -17,15 +17,15 @@ local ALIGN = core.ALIGN
local cpair = core.cpair
local s_hi_box = style.fp_theme.highlight_box
local s_hi_bright = style.fp_theme.highlight_box_bright
local label_fg = style.fp.label_fg
-- create a pocket list entry
---@param parent graphics_element parent
---@param id integer PKT session ID
local function init(parent, id)
local s_hi_box = style.fp_theme.highlight_box
local s_hi_bright = style.fp_theme.highlight_box_bright
local label_fg = style.fp.label_fg
local ps = iocontrol.get_db().fp.ps
-- root div

View File

@@ -28,14 +28,6 @@ local ALIGN = core.ALIGN
local cpair = core.cpair
local border = core.border
local s_hi_box = style.theme.highlight_box
local s_field = style.theme.field_box
local lu_cpair = style.lu_colors
local hzd_fg_bg = style.hzd_fg_bg
local dis_colors = style.dis_colors
local arrow_fg_bg = cpair(style.theme.label, s_hi_box.bkg)
local bw_fg_bg = style.bw_fg_bg
local ind_grn = style.ind_grn
@@ -50,6 +42,14 @@ local period = core.flasher.PERIOD
---@param x integer top left x
---@param y integer top left y
local function new_view(root, x, y)
local s_hi_box = style.theme.highlight_box
local s_field = style.theme.field_box
local lu_cpair = style.lu_colors
local hzd_fg_bg = style.hzd_fg_bg
local dis_colors = style.dis_colors
local arrow_fg_bg = cpair(style.theme.label, s_hi_box.bkg)
assert(root.get_height() >= (y + 24), "main display not of sufficient vertical resolution (add an additional row of monitors)")
local black = cpair(colors.black, colors.black)

View File

@@ -16,15 +16,15 @@ local StateIndicator = require("graphics.elements.indicators.state")
local cpair = core.cpair
local border = core.border
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
-- create new reactor view
---@param root graphics_element parent
---@param x integer top left x
---@param y integer top left y
---@param ps psil ps interface
local function new_view(root, x, y, ps)
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
local db = iocontrol.get_db()
local reactor = Rectangle{parent=root,border=border(1,colors.gray,true),width=30,height=7,x=x,y=y}

View File

@@ -15,15 +15,15 @@ local VerticalBar = require("graphics.elements.indicators.vbar")
local cpair = core.cpair
local border = core.border
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
-- new turbine view
---@param root graphics_element parent
---@param x integer top left x
---@param y integer top left y
---@param ps psil ps interface
local function new_view(root, x, y, ps)
local text_fg = style.theme.text_fg
local lu_col = style.lu_colors
local turbine = Rectangle{parent=root,border=border(1,colors.gray,true),width=23,height=7,x=x,y=y}
local status = StateIndicator{parent=turbine,x=7,y=1,states=style.turbine.states,value=1,min_width=12}

View File

@@ -34,16 +34,6 @@ local ALIGN = core.ALIGN
local cpair = core.cpair
local border = core.border
local s_hi_box = style.theme.highlight_box
local s_hi_bright = style.theme.highlight_box_bright
local s_field = style.theme.field_box
local hc_text = style.hc_text
local lu_cpair = style.lu_colors
local hzd_fg_bg = style.hzd_fg_bg
local dis_colors = style.dis_colors
local arrow_fg_bg = cpair(style.theme.label, s_hi_box.bkg)
local bw_fg_bg = style.bw_fg_bg
local gry_wht = style.gray_white
@@ -58,6 +48,16 @@ local period = core.flasher.PERIOD
---@param parent graphics_element parent
---@param id integer
local function init(parent, id)
local s_hi_box = style.theme.highlight_box
local s_hi_bright = style.theme.highlight_box_bright
local s_field = style.theme.field_box
local hc_text = style.hc_text
local lu_cpair = style.lu_colors
local hzd_fg_bg = style.hzd_fg_bg
local dis_colors = style.dis_colors
local arrow_fg_bg = cpair(style.theme.label, s_hi_box.bkg)
local db = iocontrol.get_db()
local unit = db.units[id] ---@type ioctl_unit
local f_ps = db.facility.ps

View File

@@ -27,12 +27,6 @@ local border = core.border
local cpair = core.cpair
local pipe = core.pipe
local s_field = style.theme.field_box
local text_c = style.text_colors
local lu_c = style.lu_colors
local lu_c_d = style.lu_colors_dark
local wh_gray = style.wh_gray
local lg_gray = style.lg_gray
@@ -46,6 +40,12 @@ local ind_wht = style.ind_wht
---@param wide boolean whether to render wide version
---@param unit ioctl_unit unit database entry
local function make(parent, x, y, wide, unit)
local s_field = style.theme.field_box
local text_c = style.text_colors
local lu_c = style.lu_colors
local lu_c_d = style.lu_colors_dark
local height = 16
local v_start = 1 + ((unit.unit_id - 1) * 5)

View File

@@ -31,17 +31,17 @@ local cpair = core.cpair
local border = core.border
local pipe = core.pipe
local s_hi_bright = style.theme.highlight_box_bright
local s_field = style.theme.field_box
local wh_gray = style.wh_gray
local text_col = style.text_colors
local lu_col = style.lu_colors
local lu_c_d = style.lu_colors_dark
-- create new flow view
---@param main graphics_element main displaybox
local function init(main)
local s_hi_bright = style.theme.highlight_box_bright
local s_field = style.theme.field_box
local text_col = style.text_colors
local lu_col = style.lu_colors
local lu_c_d = style.lu_colors_dark
local facility = iocontrol.get_db().facility
local units = iocontrol.get_db().units

View File

@@ -18,11 +18,11 @@ local DataIndicator = require("graphics.elements.indicators.data")
local ALIGN = core.ALIGN
local s_header = style.theme.header
-- create new main view
---@param main graphics_element main displaybox
local function init(main)
local s_header = style.theme.header
local facility = iocontrol.get_db().facility
local units = iocontrol.get_db().units

View File

@@ -105,8 +105,7 @@ local deepslate = {
}
}
style.theme = deepslate
-- style.theme = smooth_stone
style.theme = smooth_stone
style.root = cpair(style.theme.text, style.theme.bg)
style.label = cpair(style.theme.label, style.theme.bg)
@@ -120,6 +119,33 @@ style.lu_colors = cpair(style.theme.label, style.theme.label)
-- label & unit colors (darker if set)
style.lu_colors_dark = cpair(style.theme.label_dark, style.theme.label_dark)
-- set themes per configurations
---@param main integer main theme ID (1 = smooth_stone, 2 = deepslate)
---@param fp integer fp theme ID (1 = sandstone, 2 = basalt)
function style.set_themes(main, fp)
if main == 1 then
style.theme = smooth_stone
elseif main == 2 then
style.theme = deepslate
end
style.root = cpair(style.theme.text, style.theme.bg)
style.label = cpair(style.theme.label, style.theme.bg)
style.hc_text = cpair(style.theme.text, style.theme.text_inv)
style.text_colors = cpair(style.theme.text, style.theme.bg)
style.lu_colors = cpair(style.theme.label, style.theme.label)
style.lu_colors_dark = cpair(style.theme.label_dark, style.theme.label_dark)
if fp == 1 then
style.fp_theme = themes.sandstone
elseif fp == 2 then
style.fp_theme = themes.basalt
end
style.fp = themes.get_fp_style(style.fp_theme)
end
-- COMMON COLOR PAIRS --
style.wh_gray = cpair(colors.white, colors.gray)