Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change cursor color in Neovim Lua? #194

Open
jeschkies opened this issue Oct 20, 2022 · 3 comments
Open

How can I change cursor color in Neovim Lua? #194

jeschkies opened this issue Oct 20, 2022 · 3 comments

Comments

@jeschkies
Copy link

👋 I'm using Neovim and love this theme. However, the cursor is too light. How can I change its color via Lua?

@NLKNguyen
Copy link
Owner

You can do it in VimL. I'm not sure how to do it via Lua in NeoVim.
There is instruction for overriding colors in README. You can look up names of colors you want to override here https://github.com/NLKNguyen/papercolor-theme/blob/master/colors/PaperColor.vim#L126 or here https://github.com/NLKNguyen/papercolor-theme/blob/master/DESIGN.md#color-names

Example:

let g:PaperColor_Theme_Options = {
  \   'theme': {
  \     'default.dark': {
  \       'override' : {
  \           'cursor_fg' : ['#1c1c1c', '234'],
  \           'cursor_bg' : ['#c6c6c6', '251'],
  \       }
  \     }
  \   }
  \ }

@dusty-phillips
Copy link

dusty-phillips commented May 14, 2023

For anyone stumbling across this issue while looking for lua to dict syntax (as I did), I think it would look something like this:

vim.g.PaperColor_Theme_Options = {
     theme = {
       ['default.dark'] = {
         override = {
             cursor_fg = {'#1c1c1c', '234'},
             cursor_bg = {'#c6c6c6', '251'},
         }
       }
     }
   }

Key differences:

  • string keys are unquoted, except for default.dark, which uses lua's [] syntax to make a complex string.
  • Lists use the {} syntax rather than []
  • let g: becomes vim.g

@jeschkies
Copy link
Author

Thanks it worked. Except that I had to correct the second line to theme =.

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

No branches or pull requests

3 participants