Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .checksums
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.potions/.zshrc ac2e2e1cbf3d2a5e31008fdbe9b3e9d97ba9ec82116fc1cdc258c72773fba0c2
.potions/bin/potions 6926b4184cebb41df27fcc3c3bcadccca153e824ba8e215be62d7b9e2e030944
.version 153e5bda2de8752f08e9296dde39977766a00d9d7b5eb1a65aa2a3da5c977cfa
.version 1b05fd2e659dc017267d77a252d2e30ff7370c7e733177ac03359b3bb39d2194
drink.sh abf33ec24abd32a3305afb55ed135a22c6ab9ca04be3f28fabdb109f3daab878
install.sh 1a73f6b9f6d4b11a43161b3bcc246445b34f498425739874a278c2ea9709690d
plugins.sh dcb1d1e21939153af271d09970dda7fbce04ae62d4ca2d2aa11089e4b0c232de
Expand Down
45 changes: 35 additions & 10 deletions .potions/lib/theme/adapters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,28 @@ theme_gen_adapter_nvim() {
" :source ~/.potions/nvim/generated/palette.vim

lua << LUA
local ok, orchid = pcall(require, 'alchemists-orchid')
if ok and type(orchid.setup) == 'function' then
-- Plugin ≥ 2.0: pick the palette mode + pin the surface to the active variant.
orchid.setup({
mode = '$mode',
overrides = { bg = '$bg', fg = '$fg' },
})
else
-- Plugin missing or pre-2.0: best-effort fallback to the bundled colorscheme.
pcall(vim.cmd, 'colorscheme alchemists-orchid')
-- Apply the active Potions variant to the Alchemist's Orchid body palette.
-- Exposed as a global so the VimEnter guard below can re-assert it: the plugin
-- ships plugin/*.lua that eagerly runs setup() (DARK) + 'colorscheme
-- alchemists-orchid', and Vim sources plugin/ scripts AFTER init.vim — so that
-- default clobbers the variant we apply here, leaving only the tabline
-- (repainted on the ColorScheme event) tracking it while the editor body
-- reverts to dark. Re-running this after startup makes the body match.
function _G.PotionsApplyOrchid()
local ok, orchid = pcall(require, 'alchemists-orchid')
if ok and type(orchid.setup) == 'function' then
-- Plugin ≥ 2.0: pick the palette mode + pin the surface to the active variant.
orchid.setup({
mode = '$mode',
overrides = { bg = '$bg', fg = '$fg' },
})
else
-- Plugin missing or pre-2.0: best-effort fallback to the bundled colorscheme.
pcall(vim.cmd, 'colorscheme alchemists-orchid')
end
end

PotionsApplyOrchid()
LUA

function! s:PotionsThemeHighlights() abort
Expand Down Expand Up @@ -205,6 +216,20 @@ augroup PotionsThemeHighlights
autocmd ColorScheme * call s:PotionsThemeHighlights()
augroup END
call s:PotionsThemeHighlights()

" Re-assert the variant after Vim finishes sourcing plugin/ scripts, which run
" AFTER init.vim. The Alchemist's Orchid plugin eagerly applies its dark default
" there; without this guard the editor body reverts to dark while only the
" tabline tracks the chosen variant. Body first, then component highlights on
" top. Guarded to startup so a live re-source (potions reload) — where the
" immediate apply above already wins, with no later plugin pass — skips it.
if has('vim_starting')
augroup PotionsThemeApply
autocmd!
autocmd VimEnter * lua PotionsApplyOrchid()
autocmd VimEnter * call s:PotionsThemeHighlights()
augroup END
endif
EOF
}

Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.15.1
2.15.2
5 changes: 5 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,11 @@ test_theme_system() {
assert_file_contains "$tmp/config/generated/ansi-map.sh" '033]4;1;' "shell ansi-map emits OSC palette"
assert_file_contains "$tmp/nvim/generated/palette.vim" "mode = 'light'" "nvim white drives the plugin light mode"
assert_file_contains "$tmp/nvim/generated/palette.vim" "bg = '#fafbfc'" "nvim white pins surface bg via plugin overrides"
# The plugin's plugin/*.lua eagerly applies its dark default AFTER init.vim;
# the palette must re-assert the variant on VimEnter or the body reverts to
# dark while only the tabline tracks the variant (regression guard).
assert_file_contains "$tmp/nvim/generated/palette.vim" "PotionsApplyOrchid" "nvim palette exposes a re-callable variant apply"
assert_file_contains "$tmp/nvim/generated/palette.vim" "autocmd VimEnter \\* lua PotionsApplyOrchid()" "nvim palette re-asserts variant after plugin/ scripts load"

local st
st=$(POTIONS_HOME="$tmp" bash -c '. "'"$theme_lib"'/state.sh"; theme_state_read')
Expand Down
Loading