

local LoadTheme = require('lib.theme_loader')local ColorCount, StyleCount = LoadTheme.StartTheme(theme.Theme[tID])LoadTheme.EndTheme(ColorCount, StyleCount)local theme = {}
local LoadTheme = require('lib.theme_loader')
local themeID = 1
local themeFile = string.format('%s/MyThemeZ.lua', mq.configDir)
-- sample
---comment Check to see if the file we want to work on exists.
---@param name string -- Full Path to file
---@return boolean -- returns true if the file exists and false otherwise
local function File_Exists(name)
    local f=io.open(name,"r")
    if f~=nil then io.close(f) return true else return false end
end
local function loadTheme()
    if File_Exists(themeFile) then
        theme = dofile(themeFile)
        else
        theme = require('themes') -- your local themes file incase the user doesn't have one in config folder
    end
    themeName = theme.LoadTheme or 'Default'
        if theme and theme.Theme then
            for tID, tData in pairs(theme.Theme) do
                if tData['Name'] == themeName then
                    themeID = tID
                end
            end
       end
end
	function open_GUI(open)
    if not openGUI then return end
    --You must count your pushes so you can pop them later
    -- You MUST push your theme before ImGui.Begin and pop them before ImGui.End calls.
     local ColorCount, StyleCount = LoadTheme.StartTheme(theme.Theme[themeID])
    open, openGUI = ImGui.Begin("Window", open, bit32.bor(ImGuiWindowFlags.None, ImGuiWindowFlags.NoCollapse))
    if not openGUI then
        openGUI = false
        open = false
        -- You MUST pop the same number you pushed before ImGui.End() calls
        LoadTheme.EndTheme(ColorCount, StyleCount)
        ImGui.End()
        return open
    end
 
    -- Your content here
 
 
    -- You MUST pop the same number you pushed before ImGui.End() calls
        LoadTheme.EndTheme(ColorCount, StyleCount)
    ImGui.End()
end
	return {
    ['LoadTheme'] = 'Red', -- theme to load
    ['Theme'] = {   -- themes table
        [1] = { -- theme ID number
            ['Name'] = 'Default', -- theme name
            ['Color'] = { -- table color styles to change
                [ImGuiCol.Text]                   = { -- property ID this will convert to a number once saved we store the name value below
                    Color = {1.00, 1.00, 1.00, 1.00}, -- color value for property
                    PropertyName = "Text"  -- property human readable name
                },
                [ImGuiCol.TextDisabled]           = {
                    Color = {0.50, 0.50, 0.50, 1.00},
                    PropertyName = 'TextDisabled'
                },
                [ImGuiCol.WindowBg]               = {
                    Color = {0.06, 0.06, 0.06, 0.94},
                    PropertyName = 'WindowBg'
                },
--- rest of the theme colors
            },
        ['Style'] = {} -- table for style changes follows the same layout
        },
        [2] =.... -- next theme rinse repeat