Themify provides a public API that allows developers to integrate and interact with Themify using a simplified interface. If you want to do more advanced integration consider using the internal API.
local Themify = require('themify.api')
math.randomseed(os.time())
local colorscheme_id = Themify.Manager.colorschemes[math.random(#Themify.Manager.colorschemes)]
local colorscheme_data = Themify.Manager.get(colorscheme_id)
Themify.set_current(colorscheme_id, colorscheme_data.themes[math.random(#colorscheme_data.themes)])local Themify = require('themify.api')--- Get the current colorscheme.
--- @return vim.NIL|{ colorscheme_id: nil|string, theme: string }
Themify.get_current()--- Set the current colorscheme.
--- @param colorscheme_id nil|string
--- @param theme string
--- @return nil
Themify.set_current(<colorscheme_id>, <theme>)
--- Example
Themify.set_current('folke/tokyonight.nvim', 'tokyonight-night')
Themify.set_current(nil, 'default')Note
The corresponding module is themify.core.manager.
--- A list of id of the colorschemes in order.
--- @type string[]
Themify.Manager.colorschemes--- Get a colorscheme.
--- @param colorscheme_id string
--- @return Colorscheme_Data
Themify.Manager.get(<colorscheme_id>)
--- @class Colorscheme_Data
--- @field type 'remote'|'local'
--- @field status 'unknown'|'not_installed'|'installed'|'installing'|'updating'|'failed'
--- @field repository? Repository
--- @field progress number
--- @field info string
--- @field before? function
--- @field after? function
--- @field themes string[]
--- @field whitelist? string[]
--- @field blacklist? string[]
--- @field path string
--- Example
Themify.Manager.get('folke/tokyonight.nvim')--- Add a colorscheme to manage.
--- @param colorscheme_source string
--- @param colorscheme_info Colorscheme_Info
--- @return nil
Themify.Manager.add(<colorscheme_source>, <colorscheme_info>)
--- @class Colorscheme_Info
--- @field branch? string
--- @field before? function
--- @field after? function
--- @field whitelist? string[]
--- @field blacklist? string[]
--- Example
Themify.Manager.add('folke/tokyonight.nvim', {
whitelist = {'tokyonight-night', 'tokyonight-day'}
})--- Clean unused colorschemes.
--- @return nil
Themify.Manager.clean()--- Install the colorschemes.
--- @return nil
Themify.Manager.install()--- Update the colorschemes.
--- @return nil
Themify.Manager.update()Note
The corresponding module is themify.core.activity.
--- Get the activity of a skin.
--- @param colorscheme nil|string
--- @param theme string
--- @return nil|{ last_active: number, total_minutes: number, today_minutes: number }
Themify.Activity.get(<colorscheme>, <theme>)
--- Example
Themify.Activity.get('folke/tokyonight.nvim', 'tokyonight-night')
Themify.Activity.get(nil, 'default')Note
The corresponding module is themify.core.event.
--- Listen to an event.
--- @param event string
--- @param callback function
--- @return nil
Themify.Event.listen(<event>, <callback>)| Event | Description | Arguments |
|---|---|---|
| colorscheme-loaded | When a colorscheme is loaded. | (colorscheme_id, theme) |
| colorscheme-state-updated | When the state of a colorscheme is updated. | (colorscheme_id) |
| colorscheme-installed | When a colorscheme is installed. | (colorscheme_id) |
| colorscheme-updated | When a colorscheme is updated. | (colorscheme_id) |
| activity-update | When the activity is updated. | () |
| interface-opened | When an interface is opened. | (window) |
| interface-closed | When an interface is closed. | () |
| interface-update | When the interfaces are being updated. | () |