No description
  • Zig 95.6%
  • Nix 4.4%
Find a file
2025-07-25 13:03:21 +02:00
assets Add assets for github readme 2025-07-25 12:41:43 +02:00
src Bump version to 1.0.3 2025-07-25 01:15:52 +02:00
.gitignore Flake can now build build/run/test zig, add lock file and update 2025-07-20 12:03:18 +02:00
.README Initial commit 2025-07-19 01:11:00 +02:00
build.zig Add clap library 2025-07-21 21:11:45 +02:00
build.zig.zon Add clap library 2025-07-21 21:11:45 +02:00
build.zig.zon2json-lock Bump version 1.0.2 and use zig2nix 2025-07-24 13:10:04 +02:00
flake.lock Bump version 1.0.2 and use zig2nix 2025-07-24 13:10:04 +02:00
flake.nix Bump version to 1.0.3 2025-07-25 01:15:52 +02:00
README.md Update README.md 2025-07-25 13:03:21 +02:00

colorsync

A CLI tool for managing color theme configurations.

Preview Explanation screenshot

What is this?

This tool is solely responsible for setting a serializable state on your system and providing a convenient way for scriptable applications to read the current state. Thats it. You still need to implement the actual theme switching logic in each application yourself.

For examples of how Ive achieved this, see my dotfiles repository. A good starting point is my Ayu colorscheme setup for Neovim.

Here's a snippet example from my colorscheme setup:

local function set_colorscheme()
    -- Run the actual colorscheme setup
    -- This will get re run when updating colorsync with a new value.
end

vim.api.nvim_create_augroup("ColorsyncEvents", { clear = true })

local filepath = os.getenv("HOME") .. "/.local/state/colorsync/current"
local handle = uv.new_fs_event()
handle:start(filepath, {}, function()
    vim.schedule(function()
        set_colorscheme()
        -- You can now react off off the ColorsyncThemeChanged event if you need to update plugins as well.
        vim.api.nvim_exec_autocmds("User", { pattern = "ColorsyncThemeChanged" })
        vim.api.nvim_exec_autocmds("ColorScheme", {})
    end)
end)

-- Make sure to also call it outside of the file watching update
set_colorscheme()

If you need to switch themes in an application that doesnt natively support file watching, consider using Watchman to monitor ~/.local/state/colorsync/current and trigger a script when the file changes.

Config

The config only holds pure text, each line is an entry, and each entry only signals valid themes that you can switch to. The config resides at ~/.config/colorsync/colorsyncrc.

Here is my config shown in the preview gif:

ayudark
ayumirage
ayulight

Build & Run with Nix

nix run github:LarssonMartin1998/colorsync#default

Build & Run without Nix

Requires Zig.

zig build run
# binaries can be found here
zig-out/bin/colorsync

Commands

  • set <theme>
  • get
  • show