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

Revert transparent background when winblend/pumblend option is set? #401

Closed
jamestansx opened this issue Feb 11, 2023 · 7 comments · Fixed by #403
Closed

Revert transparent background when winblend/pumblend option is set? #401

jamestansx opened this issue Feb 11, 2023 · 7 comments · Fixed by #403
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jamestansx
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When the transparent_background is set, setting winblend and/or pumblend would cause the bg to set to black. As a result, I have to override all the highlight that is set to None (including the integration's colors).

Describe the solution you'd like
Perhaps just add a condition to check if winblend and/or pumblend value is set for the respective highlight color.

Describe alternatives you've considered
Manually overriding all the highlight groups that is affected, as what I'm doing now. However, it would be better if I do not need to configure manually as I would need to refer to the source code and find the corresponding color name.

Additional context
-

@jamestansx jamestansx added the enhancement New feature or request label Feb 11, 2023
@nullchilly
Copy link
Member

nullchilly commented Feb 11, 2023

Can you explain which highlight groups are affected, this is my cmp with winblend and pumblend and it seems correct to me:

image

cc @emxxjnm Any insights on this problem?

@jamestansx
Copy link
Contributor Author

The affected highlight groups are NormalFloat and Pmenu. For dressing.nvim integration, the NoiceCmdlinePopup, NoicePopup, etc also been affected. I guess if the plugin does not explicitly configure winblend or pumblend to 0, then it will show as black (just like how the vim's popup menu turns black).

I will be using this minimal init.lua to demonstrate the problem that I am talking about.

minimal init.lua
vim.o.termguicolors = true
vim.o.winblend = 10
vim.o.pumblend = 10
vim.g.mapleader = " "

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath, })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "catppuccin/nvim",
    name = "catppuccin",
    lazy = false,
    priority = 1000,
    opts = {
      flavour = "mocha",
      transparent_background = true,
    },
    config = function(_, opts)
      require("catppuccin").setup(opts)
      vim.cmd.colorscheme("catppuccin")
    end
  },
  {
    "nvim-telescope/telescope.nvim",
    cmd = "Telescope",
    version = false,
    dependencies = { "nvim-lua/plenary.nvim" },
    config = true,
  }
})

If I open the popup menu, it will show in black colour. Same goes to the Lazy float window.

image
image

However, notice that telescope window does not affect because by default it sets winblend to 0.

image

@nullchilly nullchilly added the good first issue Good for newcomers label Feb 11, 2023
@nullchilly
Copy link
Member

nullchilly commented Feb 11, 2023

So basically

O.transparent_float = O.transparent_background and vim.o.winblend == 0
NormalFloat = { fg = C.text, bg = O.transparent_float and C.none or C.mantle }

Is this the desired behavior?

@jamestansx
Copy link
Contributor Author

Yes, indeed!

@nullchilly
Copy link
Member

Can you checkout the blend branch?

{ "catppuccin/nvim", branch = "blend" }

@jamestansx
Copy link
Contributor Author

Looks good to me 👍🏼

image

@cxzhou35
Copy link

cxzhou35 commented May 4, 2023

Can you explain which highlight groups are affected, this is my cmp with winblend and pumblend and it seems correct to me:

image

cc @emxxjnm Any insights on this problem?

I am sorry to comment on this closed issue, but I am curious about how to config the nvim-cmp like yours popup window?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants