11-- Kanagawa theme switcher.
22--
3- -- Presents a which-key menu of the installed flavors and persists the choice to
3+ -- Presents a which-key menu of the dark flavors and persists the choice to
44-- yazi's state dir (~/.local/state/yazi/theme.toml, an out-of-store symlink the
55-- nix config points $XDG_CONFIG_HOME/yazi/theme.toml at). yazi reads
66-- theme.toml's [flavor] only at startup and offers no live flavor reload, so the
77-- selection takes effect on the next launch — hence the notify.
8+ --
9+ -- Only the dark flavors are offered here: the choice fills theme.toml's `dark`
10+ -- slot, while the `light` slot is pinned to the light Lotus flavor. yazi detects
11+ -- the terminal's color mode at startup and picks the matching slot, so Lotus is
12+ -- never presented as a manual option — it only activates on a light terminal.
13+ -- (A "light" flavor can't repaint a dark terminal: yazi paints widget bgs only,
14+ -- so the file-list body shows the terminal background regardless.)
815
916local THEMES = {
1017 { on = " k" , flavor = " kanagawa-kris" , desc = " Kanagawa Kris" },
1118 { on = " w" , flavor = " kanagawa-wave" , desc = " Kanagawa Wave" },
1219 { on = " d" , flavor = " kanagawa-dragon" , desc = " Kanagawa Dragon" },
13- { on = " l" , flavor = " kanagawa-lotus" , desc = " Kanagawa Lotus (light)" },
1420}
1521
1622-- Resolve ~/.local/state/yazi, honoring XDG_STATE_HOME. os.getenv is pure (no
@@ -37,7 +43,9 @@ return {
3743
3844 local flavor = THEMES [idx ].flavor
3945 local dir = state_dir ()
40- local body = string.format (' [flavor]\n dark = "%s"\n light = "%s"\n ' , flavor , flavor )
46+ -- Chosen flavor drives the dark slot; light stays pinned to Lotus so yazi
47+ -- auto-selects it only when the terminal is in light mode.
48+ local body = string.format (' [flavor]\n dark = "%s"\n light = "kanagawa-lotus"\n ' , flavor )
4149
4250 -- Ensure the state dir exists (it normally does, seeded by activation).
4351 fs .create (" dir_all" , Url (dir ))
@@ -55,7 +63,7 @@ return {
5563
5664 ya .notify ({
5765 title = " Theme" ,
58- content = " Set " .. flavor .. " . Restart yazi to apply." ,
66+ content = " Set dark flavor to " .. flavor .. " . Restart yazi to apply." ,
5967 timeout = 5 ,
6068 level = " info" ,
6169 })
0 commit comments