tjdevries / colorbuddy.nvim

Your color buddy for making cool neovim color schemes
MIT License
666 stars 24 forks source link

Unclear setup of own colorschemes #5

Closed koopa1338 closed 8 months ago

koopa1338 commented 4 years ago

The README shows some example themes but it lacks some information about how to setup your own colorscheme:

My naive try was:

  1. install the Plugin and load it via packadd
  2. create a nvim/lua/colors.lua file and define my colorscheme
  3. require that file in my init.lua

→ didn't work, for some reason my colors are broken but I don't get any error messages.

rockerBOO commented 4 years ago

I just made a simple colorscheme. So I think you got it for the most part but requiring the file runs into caching problems. I found if i had it return from the module it works better. So for example instead of JUST requiring, make the module return a function that you can call to set the color scheme.

https://github.com/rockerBOO/boo-colorscheme-nvim/blob/main/lua/boo-colorscheme.lua#L8

And then I have

lua require'boo-colorscheme'.use{}
redbug312 commented 3 years ago

@rockerBOO I was searching for the caching problem and found a solution. It seems require won't load the same file, as explained in nvim-lua-guide#1.

Loaded info must be removed to make :colorscheme force-reload, so I've done this in colors/cactusbuddy.vim of my colorscheme.

lua package.loaded.cactusbuddy = nil
lua require('cactusbuddy')
thepenguinthatwants commented 3 years ago

I think this seriously needs a documentation as this might become way more popular if it gives sense how to use it.

tjdevries commented 8 months ago

Should be just colorscheme blah now and load it with lua, i included example one in repo now as well :)