Skip to content

Conversation

@behcet
Copy link

@behcet behcet commented Dec 16, 2025

Problem

When using vim.cmd.colorscheme('base16-xyz'), the colorscheme .vim file passes colors directly to setup():

  lua require('base16-colorscheme').setup({
      \ base00 = '#303446', base01 = '#292c3c', ...
      \})

However, setup() unconditionally checks BASE16_THEME and accesses M.colorschemes[vim.env.BASE16_THEME] at line 141, even when colors are already provided. This triggers the metatable __index, which calls require('colors.' .. key).

This fails when the lua/colors/ directory isn't in package.path which can happen depending on how plugin managers set up paths.

The issue is masked when running inside tmux because the vim.env.TMUX ~= nil check skips this code path entirely.

Fix

Only perform the BASE16_THEME lookup when colors is nil:

This is backwards compatible. The BASE16_THEME auto-detection only makes sense when no colors are explicitly provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant