AstroNvim / astrotheme

The default colorscheme used by AstroNvim
https://AstroNvim.com
GNU General Public License v3.0
97 stars 19 forks source link

Theme does not apply after installing with packer #43

Closed promitheas17j closed 1 year ago

promitheas17j commented 1 year ago

In my packer.lua file I have:

return require('packer').startup(function(use)
    ...
    use "AstroNvim/astrotheme"
    ...
end)

but the theme doesnt seem to be applying.

If I try to run the command colorscheme astrodark manually, then I get the following error:

Error detected while processing /home/turing/.local/share/nvim/site/pack/packer/s
tart/astrotheme/colors/astrodark.lua:
E5113: Error while calling lua chunk: ...pack/packer/start/astrotheme/lua/astroth
eme/lib/util.lua:44: attempt to index field 'palettes' (a nil value)
stack traceback:
        ...pack/packer/start/astrotheme/lua/astrotheme/lib/util.lua:44: in functi
on 'set_palettes'
        ...ite/pack/packer/start/astrotheme/lua/astrotheme/init.lua:14: in functi
on 'load'
        ...m/site/pack/packer/start/astrotheme/colors/astrodark.lua:1: in main ch
unk
A-Lamia commented 1 year ago

oh i think i know what might be wrong.

EDIT: nope actually this error would error in lazy as well, that's confusing

promitheas17j commented 1 year ago

If there is any further info you need let me know

A-Lamia commented 1 year ago

I can't really test with packer right now, does packer run require("astrotheme").setup() automatically ?

Could you also try to run colorscheme astrotheme

edit: it seems like for what ever reason the setup logic is unable to find the palettes folder that is really strange.

promitheas17j commented 1 year ago

Last night is when I first started playing around with neovim and configuring it, so I'm not sure what you mean. Here is my nvim/lua/user/packer.lua file contents so far:

-- This file can be loaded by calling `lua require('plugins')` from your init.vim

-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]

return require('packer').startup(function(use)
  -- Packer can manage itself
  use 'wbthomason/packer.nvim'

  use "AstroNvim/astrotheme"

  --[[ Used this theme to test whether it was a general problem with my setup, or just with that specific theme.
  Nightfly works fine
  use { "bluz71/vim-nightfly-colors", as = "nightfly" }
  vim.cmd [[colorscheme nightfly ]]
  --]]
  use {
      'nvim-telescope/telescope.nvim', tag = '0.1.1',
      -- or                            , branch = '0.1.x',
      requires = { {'nvim-lua/plenary.nvim'} }
  }

  use('nvim-treesitter/nvim-treesitter', {run =  ':TSUpdate'})

end)

Also, running the command colorscheme astrotheme give me the error in my original issue post. However, if I try to use tab completion after typing :colorscheme astrotheme does show up in the list, as well as astrolight and astrodark.

A-Lamia commented 1 year ago

try

use {
    "AstroNvim/astrotheme",
     config = function() 
        require("astrotheme").setup()
     end,
}
promitheas17j commented 1 year ago

That seems to work, however previously I had the following lines for transparency:

vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })

to make the background transparent in a colors.lua file in the after/ directory. The only way the astrotheme will enable on starting nvim is if I comment those lines out. Any idea why that is, and how I can get transparency to work with this theme?

Thank you.

A-Lamia commented 1 year ago

You are probably having a load order issue, where those highlights are being set then the theme is loading overwriting your changes, so it seems you have 2 options to resolve this:

  1. Setup and autocmd that will set your highlights every time a theme is set.
  2. Most themes including Astrotheme have settings that allow you to override the themes highlights.

I'll be closing this now as the original issue is resolved.