A fast, lightweight Neovim plugin that automatically changes your colorscheme based on time of day schedules or system appearance.
- Time-based schedules for automatic theme changes throughout the day.
- System appearance sync that follows your OS light or dark mode.
- Interactive TUI for both schedule entries and default theme settings.
- State persistence saves your changes automatically.
- Zero startup impact using fully asynchronous background detection.
Using lazy.nvim:
{
"luxus/colorful-times-nvim",
lazy = false,
priority = 1000, -- Colorscheme plugins must load first
opts = {
-- See configuration section below
},
}require("colorful-times").setup({
default = {
colorscheme = "default",
background = "system", -- "light", "dark", or "system"
},
schedule = {
{ start = "08:00", stop = "18:00", colorscheme = "tokyonight-day", background = "light" },
{ start = "18:00", stop = "08:00", colorscheme = "tokyonight-night", background = "dark" },
},
})Here are the default options.
{
enabled = true,
refresh_time = 5000, -- Milliseconds between system appearance polls
system_background_detection = nil,
system_background_detection_script = nil,
default = {
colorscheme = "default",
background = "system",
themes = { light = nil, dark = nil },
},
schedule = {},
persist = true, -- Set to false to disable state persistence
}The snacks.nvim plugin is optional. If installed, Colorful Times uses it to provide a fuzzy colorscheme picker with live preview in the TUI.
| Command | Description |
|---|---|
:ColorfulTimes |
Open the interactive schedule manager |
:ColorfulTimesEnable |
Enable the plugin |
:ColorfulTimesDisable |
Disable the plugin |
:ColorfulTimesToggle |
Enable or disable the plugin |
:ColorfulTimesReload |
Reload configuration from disk |
:ColorfulTimesStatus |
Show the current resolved theme state |
:checkhealth colorful-times |
Run diagnostics |
Run :ColorfulTimes to open the interactive manager.
┌─────────────────── Colorful Times ─────────────────────┐
│ [●] ENABLED 2.2.0 │
│ ────────────────────────────────────────────────────── │
│ DEFAULT kanagawa BG system │
│ LIGHT kanagawa-lotus │
│ DARK kanagawa-wave │
│ ORDER schedule > default.background > default... │
│ ────────────────────────────────────────────────────── │
│ START STOP COLORSCHEME BG │
│ ────────────────────────────────────────────────────── │
│ 06:00 18:00 tokyonight-day light │
│ 18:00 06:00 tokyonight dark │
│ ────────────────────────────────────────────────────── │
│ [a] add [e/<CR>] edit [d/x] delete [c] default... │
│ [l] light override [n] dark override ... │
└─────────────────────────────────────────────────────────┘
| Key | Action |
|---|---|
j / Down |
Move down |
k / Up |
Move up |
a |
Add new entry |
e / Enter |
Edit selected entry |
d / x |
Delete selected entry |
c |
Set the fallback default colorscheme |
b |
Set the fallback default background |
l |
Set or clear the system-light theme override |
n |
Set or clear the system-dark theme override |
t |
Toggle enabled or disabled |
r |
Reload configuration |
? |
Show help |
q / Esc |
Close TUI |
Colorful Times resolves the active theme in this order:
- Matching schedule entry
default.backgrounddefault.colorschemeordefault.themes.light/default.themes.dark
If the resolved background is system, the plugin keeps a safe fallback first
and then updates to the detected light or dark background asynchronously.
The plugin detects your system appearance based on your OS environment.
Priority order:
system_background_detectionas a Lua function overridesystem_background_detectionas a command table override- macOS auto-detection via
osascript, withdefaults readfallback - Linux custom script via
system_background_detection_script - Linux KDE/GNOME auto-detection via
kreadconfig5/kreadconfig6orgsettings
The function and command overrides work on any platform. The custom script is Linux-only.
If you use macOS keyboard shortcuts or Automator scripts to toggle system appearance, the change might not be detected immediately. The plugin relies on an asynchronous polling mechanism. You might need to wait 1 to 2 poll cycles. You can adjust the refresh_time in your configuration to a lower value for faster detection. If the theme still doesn't update, run :ColorfulTimesReload to force a manual check.
When persist = true, the plugin saves schedule edits, toggle state, and
default theme settings to disk immediately. :ColorfulTimesReload rebuilds
the live config from your setup config plus the persisted state file.
State file location:
~/.local/share/nvim/colorful-times/state.json
If the TUI shows unexpected entries or the configuration breaks, you can reset the state by deleting this file. The plugin will rebuild it from your configuration on the next run.
You can call these public functions directly in your Lua configuration.
local ct = require("colorful-times")
-- Initialize the plugin with options
ct.setup({ ... })
-- Toggle the plugin enabled/disabled state
ct.enable()
ct.disable()
ct.toggle()
-- Reload the configuration and re-apply colorschemes
ct.reload()
-- Open the schedule manager TUI
ct.open()
-- Inspect the current resolved state
ct.status()Colorful Times guarantees zero startup impact. It achieves this by lazily loading heavy modules on their first use. All background detection and file operations use fully asynchronous vim.uv APIs. The plugin also pre-caches schedules and uses an efficient LRU cache for time parsing to minimize CPU cycles.
MIT License. See LICENSE for details.