LogoObsidian

ThemeManager

Using the ThemeManager addon to manage themes in Obsidian

What is the ThemeManager?

The ThemeManager addon ships with a library of built-in color schemes and helper utilities to create, persist and reuse custom themes for your Obsidian UI.

Quick Start

Add the ThemeManager alongside your library and attach it to a tab or groupbox so users can tweak colors on the fly:

local repo = "https://raw.githubusercontent.com/deividcomsono/Obsidian/main/"
local Library = loadstring(game:HttpGet(repo .. "Library.lua"))()
local ThemeManager = loadstring(game:HttpGet(repo .. "addons/ThemeManager.lua"))()
 
-- register the library so ThemeManager can manipulate controls
ThemeManager:SetLibrary(Library)
 
-- optional: keep themes inside a custom folder
ThemeManager:SetFolder("MyScriptHub")
 
local Tab = Window:AddTab("UI Settings", "settings")
 
-- automatically creates the color pickers, theme lists and buttons
ThemeManager:ApplyToTab(Tab)
 
-- apply whatever theme is flagged as default (built-in or custom)
ThemeManager:LoadDefault()

Built-In Themes

ThemeManager.BuiltInThemes exposes packaged schemes such as Default, BBot, Fatality, Nord, Dracula, Catppuccin and more. These are available instantly from the “Theme list” dropdown created by ApplyToTab.

API Reference

Methods

SetLibrary

Registers the UI library instance so ThemeManager can read and update color pickers.

ThemeManager:SetLibrary(Library)
Arg IdxArgument DescriptionTypeDefault
1Library to use for the ThemeManagerLibrary (table)nil

SetFolder

Overrides the base folder used to store theme JSON files and default markers.

ThemeManager:SetFolder(folder)
Arg IdxArgument DescriptionTypeDefault
1Folder path relative to workspacestring"ObsidianLibSettings"

ApplyTheme

Applies either a built-in theme or a custom theme saved on disk.

ThemeManager:ApplyTheme(name)
Arg IdxArgument DescriptionTypeDefault
1Theme name (built-in or custom)stringnil

ThemeUpdate

Pushes the current picker values back into the library scheme. Automatically called when color pickers change, but exposed if you need to trigger it manually.

ThemeManager:ThemeUpdate()

GetCustomTheme

Loads a custom theme JSON file and returns the decoded table.

local theme = ThemeManager:GetCustomTheme(name)
Arg IdxArgument DescriptionTypeDefault
1Theme file name without extensionstringnil

Returns table?; nil when the file does not exist or cannot be decoded.

LoadDefault

Reads the saved default marker and applies the relevant theme (built-in or custom).

ThemeManager:LoadDefault()

SaveDefault

Stores the provided theme name as the default choice for future sessions.

ThemeManager:SaveDefault(name)
Arg IdxArgument DescriptionTypeDefault
1Theme name to persiststringnil

SetDefaultTheme

Replaces the built-in Default theme with custom color definitions before rendering the UI. Call this before ApplyToTab.

ThemeManager:SetDefaultTheme(theme)
Arg IdxArgument DescriptionTypeDefault
1Table containing FontColor, MainColor, AccentColor, BackgroundColor, OutlineColor, FontFacetablenil

SaveCustomTheme

Serializes the current picker values to <folder>/themes/<name>.json.

ThemeManager:SaveCustomTheme(name)
Arg IdxArgument DescriptionTypeDefault
1Theme name without file extensionstringnil

Delete

Removes a saved custom theme file from disk.

local success, err = ThemeManager:Delete(name)
Arg IdxArgument DescriptionTypeDefault
1Theme name without file extensionstringnil

Returns boolean, string? describing the result.

ReloadCustomThemes

Re-scans the theme directory and returns a list of custom theme names.

local names = ThemeManager:ReloadCustomThemes()

Returns { string } of theme names.

CreateThemeManager

Builds the ThemeManager controls inside a provided groupbox (color pickers, dropdowns and action buttons).

ThemeManager:CreateThemeManager(groupbox)
Arg IdxArgument DescriptionTypeDefault
1Groupbox returned by AddLeftGroupbox/AddRightGroupboxGroupbox (table)nil

CreateGroupBox

Helper that creates the standard “Themes” groupbox on the left side of a tab.

local groupbox = ThemeManager:CreateGroupBox(tab)
Arg IdxArgument DescriptionTypeDefault
1Tab returned by Window:AddTabTab (table)nil

Returns the created groupbox so you can customize it further before calling CreateThemeManager.

ApplyToTab

Creates a groupbox within the tab and installs the ThemeManager UI into it.

ThemeManager:ApplyToTab(tab)
Arg IdxArgument DescriptionTypeDefault
1Tab returned by Window:AddTabTab (table)nil

ApplyToGroupbox

Installs the ThemeManager UI into an existing groupbox.

ThemeManager:ApplyToGroupbox(groupbox)
Arg IdxArgument DescriptionTypeDefault
1Groupbox to populateGroupbox (table)nil

On this page