No description
- Lua 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| doc | ||
| lua/ghostty-theme-sync | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| stylua.toml | ||
ghostty-theme-sync.nvim
Keep Neovim's colors in sync with the theme currently active in
Ghostty. It reads Ghostty's own config and theme files,
so it also understands light:Theme,dark:Theme and automatic light/dark
switching.
Features
- Reads Ghostty's config,
config-fileincludes, and theme files directly. - Supports plain themes and
light:...,dark:...theme pairs. - Follows the desktop light/dark appearance on Linux, macOS, and Windows.
- Live-reloads when the Ghostty config or a theme file changes.
- Provides a full Neovim highlight set derived from the Ghostty palette.
- Adds
:GhosttySync,:GhosttyInfo, and:checkhealth ghostty-theme-sync.
Requirements
- Neovim 0.10+.
- Ghostty with a readable config file.
- Linux:
gsettingsand/orgdbusfor automatic appearance detection. Without them, Neovim'sbackgroundoption is used. - macOS: the built-in
defaultscommand. - Windows: the built-in
regcommand; setconfig_pathif Ghostty uses a nonstandard location.
Installation
lazy.nvim
{
url = "git@git.tsivinsky.com:tsivinsky/ghostty-sync.nvim.git",
config = function()
require("ghostty-theme-sync").setup()
end,
}
For local development:
{
dir = vim.fn.expand("~/dev/personal/ghostty-theme-sync.nvim"),
config = function()
require("ghostty-theme-sync").setup()
end,
}
vim.pack
Requires Neovim 0.12 or newer.
vim.pack.add({
{ src = "git@git.tsivinsky.com:tsivinsky/ghostty-sync.nvim.git" },
})
require("ghostty-theme-sync").setup()
Adjust the repository URL/name to match the remote you use. The Lua module name is
ghostty-theme-sync, independent of the repository name.
Configuration
require("ghostty-theme-sync").setup({
-- "auto" follows the desktop appearance; or force "light" / "dark".
background = "auto",
-- Follow desktop light/dark changes and reapply automatically.
follow_system_theme = true,
-- Remove the background color from normal windows.
transparent = false,
-- Update the palette used by `:terminal`.
terminal_colors = true,
-- Reapply when Ghostty's config or the selected theme file changes.
watch = true,
-- Reapply when `:set background=light|dark` changes.
follow_background = true,
-- Optional overrides for nonstandard installations.
-- config_path = "/path/to/ghostty/config",
-- theme_dirs = { "/path/to/ghostty/themes" },
})
Commands
| Command | Description |
|---|---|
:GhosttySync |
Re-read Ghostty's config and reapply the theme |
:GhosttyInfo |
Show the active theme, variant, and detected appearance |
:checkhealth ghostty-theme-sync |
Check config discovery and platform support |
How appearance detection works
Ghostty switches between the light:... and dark:... themes using the
desktop environment's appearance. The plugin uses the same sources:
| Platform | Source | Live updates |
|---|---|---|
| Linux | GSettings color-scheme, then XDG portal, then GTK theme |
gsettings monitor / portal signal, 10s polling fallback |
| macOS | defaults read -g AppleInterfaceStyle |
10s polling + focus events |
| Windows | AppsUseLightTheme registry value |
10s polling + focus events |
ghostty +show-config is deliberately not used: it does not run Ghostty's GTK
appearance machinery, so it can report the light variant while a running
Ghostty window is dark.
API
local ghostty = require("ghostty-theme-sync")
ghostty.setup(opts) -- apply the theme and install commands/hooks
ghostty.sync() -- reload the config and reapply
ghostty.load(opts) -- load and apply once
ghostty.get() -- last applied theme table
ghostty.info() -- print theme information
ghostty.detect_appearance() -- "light", "dark", or nil
License
MIT