mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#405 WIP themes and completed main display theme implementation
This commit is contained in:
@ -7,7 +7,7 @@ local flasher = require("graphics.flasher")
|
||||
|
||||
local core = {}
|
||||
|
||||
core.version = "2.1.1"
|
||||
core.version = "2.2.0"
|
||||
|
||||
core.flasher = flasher
|
||||
core.events = events
|
||||
@ -61,6 +61,9 @@ end
|
||||
---@field blit_fgd string
|
||||
---@field blit_bkg string
|
||||
|
||||
-- add inherited flag, 3 isn't a pure color so it wouldn't be used
|
||||
colors._INHERIT = 3
|
||||
|
||||
-- create a new color pair definition
|
||||
---@nodiscard
|
||||
---@param a color
|
||||
|
@ -234,11 +234,24 @@ function element.new(args, child_offset_x, child_offset_y)
|
||||
|
||||
-- init colors
|
||||
if args.fg_bg ~= nil then
|
||||
protected.fg_bg = args.fg_bg
|
||||
elseif args.parent ~= nil then
|
||||
protected.fg_bg = args.parent.get_fg_bg()
|
||||
protected.fg_bg = core.cpair(args.fg_bg.fgd, args.fg_bg.bkg)
|
||||
end
|
||||
|
||||
if args.parent ~= nil then
|
||||
local p_fg_bg = args.parent.get_fg_bg()
|
||||
|
||||
if args.fg_bg == nil then
|
||||
protected.fg_bg = core.cpair(p_fg_bg.fgd, p_fg_bg.bkg)
|
||||
else
|
||||
if protected.fg_bg.fgd == colors._INHERIT then protected.fg_bg = core.cpair(p_fg_bg.fgd, protected.fg_bg.bkg) end
|
||||
if protected.fg_bg.bkg == colors._INHERIT then protected.fg_bg = core.cpair(protected.fg_bg.fgd, p_fg_bg.bkg) end
|
||||
end
|
||||
end
|
||||
|
||||
-- check colors
|
||||
element.assert(protected.fg_bg.fgd ~= colors._INHERIT, "could not determine foreground color to inherit")
|
||||
element.assert(protected.fg_bg.bkg ~= colors._INHERIT, "could not determine background color to inherit")
|
||||
|
||||
-- set colors
|
||||
protected.window.setBackgroundColor(protected.fg_bg.bkg)
|
||||
protected.window.setTextColor(protected.fg_bg.fgd)
|
||||
|
Reference in New Issue
Block a user