• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->
Resource icon

Utility ThemeZ 04/10/2024

Download now:  Join us with Level 2 access or earn your way in with  RedCents.
with the help of Derple we (mostly Derple)

added a library to draw your themes.

the library works with both ThemeZ's MyThemeZ.lua and button masters button_master_theme.lua file formats.

also adds support for dynamically changing colors or styles.

Support to set that up will be coming soon to ThemeZ so you can configure and export these.

Usage:
Add the lib folder to your script.
local LoadTheme = require('lib.theme_loader')
Load your themes file of choice into a table.

at the beginning of the window before calling ImGui.Begin()

pass the theme you want to load's table

local ColorCount, StyleCount = LoadTheme.StartTheme(theme.Theme[tID])

End the theme before ImGui.End()

LoadTheme.EndTheme(ColorCount, StyleCount)

sample:
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

Applying theme to window

applying to the window:
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


ThemeZ file Layout

themes.lua:
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
Back
Top