EdenEast / nightfox.nvim

🦊A highly customizable theme for vim and neovim with support for lsp, treesitter and a variety of plugins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

help: cannot change tthe color and style of MatchParen group

halshar opened this issue · comments

Neovim version (nvim -v)

v0.9.2

Operating system/version

Fedora Linux - 38

Describe the bug

I'm trying to change the MatchParen color for the carbonfox them but i'm not seeing any changes

return {
"EdenEast/nightfox.nvim",
lazy = false,
priority = 1000,
config = function()
require("nightfox").setup({
  options = {
    groups = {
      carbonfox = {
        MatchParen = { fg = "yellow" },
      },
    },
  },
})
vim.cmd("colorscheme carbonfox")
end,
}

Steps To Reproduce

  1. copy the config
  2. go over any parenthesis

Expected Behavior

carbonfox

what I want is for the opening and closing parenthesis to have the same block and color, in the above config I was trying with yellow but I don't see any changes

Repro

No response

Looking at the setup call you have the groups table nested inside the options table. The correct table would be:

require("nightfox").setup({
  options = {
    -- ...
  },
  groups = {
    carbonfox = {
      MatchParen = { fg = "yellow" },
    },
  },
})

thank you, it works but how do I make both the highlight be a block of same color i.e purple color of the carbonfox theme?

Not sure I understand the question. Which highlight groups are you referring to? Or do you mean inverting the highlight group so the background is magenta and the foreground is the background?

carbonfox

in the above screenshot only the opening parenthesis is highlighted with block, I want the same thing for the closing parenthesis as well, can this be done?

Your cursor is handed by your terminal and not neovim. I am guessing that you are using alacritty and have it set to reverse the current cell.

For example I am using wezterm and the cursor is static (always black foreground and white background).

image
image

no, what I mean is I want the opening and the closing parenthesis to be have cursor blocks

  1. correct
    here, both the opening and closing parenthesis have cursor blocks

  1. wrong
    and here, both the parenthesis are highlighted but only the opening one has cursor block

the first screenshot is of the default theme and the second is of carbonfox

The 'cursor block' you are referring to it just setting the background color (the default is: MatchParen MatchParen xxx ctermbg=6 guibg=DarkCyan).

Option 1

Set the foreground and background of the MatchParen highlight group.

require("nightfox").setup({
  groups = {
    all = {
      MatchParen = { bg = "palette.yellow", fg = "bg1" },
    },
  },
})

Option 2

Use the reverse style for MatchParen which reverses the foreground and background (see :h attr-list for list of styles)

require("nightfox").setup({
  groups = {
    all = {
      MatchParen = { fg = "palette.cyan", style = "reverse" },
    },
  },
})

Option 3

Use builtin shortcut in nightfox for reverse the match parens with options.inverse.match_paren = true.

require("nightfox").setup({
  options = {
    inverse = {
      match_paren = true,
    },
  },
  groups = {
    all = {
      MatchParen = { fg = "palette.cyan" },
    },
  },
})

Note

For the groups table it uses the spec table. If you want to refer to a palette color, prefix with palette..

I tried all 3 methods and setting the inverse makes the closing parenthesis highlight instead of the opening one, but what I want is for both the opening and closing parenthesis to be highlighted and having a block, is this possible?

Neovim can only set the highlight for the matched pairs. As pairs are highlighted based on your cursor's position it requires one of the pairs to be behind your cursor. Neovim does not control the cursor that is handled by your terminal. That is something you would have to consult your terminals cursor settings.

For example alacritty's default cursor swaps the cells forground and background for the cursor. And wezterm sets the color statically.

carbox-issue-02

maybe I'm explaining something wrong, but this behavior works fine with default neovim theme(as seen in above screenshot, both the opening and closing parentheses are highlighted and have block over them) along with the several other themes I have used in the past

Yes from the image that you provided your cursor is reversing the cell. I am guessing that you are using alacritty, (as that is the default behaviour). They both look like blocks because they are both different colors then the background color.
The default highlight only sets the background color and does not set a foreground color.

For example setting MatchParen to

MatchParen = { fg = "", bg = "palette.cyan" },

Would result in the following in alacritty:

image

And the same line with a different foreground color (commented)

image

And the same as the above but in wezterm

image

thanks a lot, this works and sorry for all the trouble :)