:highlight Normal guifg=0 guibg=0
worked for me, at least when run interactively in a nvim -u NORC
session.
From the neovim 0.10 changelog:
'termguicolors' is enabled by default when Nvim is able to determine that the host terminal emulator supports 24-bit color.
So for me, i previously had vim.cmd.hi 'Normal ctermbg=none'
as the method for disabling the background. But now, nvim was deciding to use gui colors for the terminal, and I was only setting terminal background to none.
The options are:
vim.cmd.hi 'Normal ctermbg=none guibg=none'
(also none out the gui bg)vim.cmd.hi 'Normal bg=none'
(flat unconditional bg none)vim.opt.termguicolors = false
(just disable the now enabled by default function to go back to terminal colors)
This looks fine when doing it manually, thanks. I wonder how to properly implementing this in my Lua-only setup without just wrapping it in vim.cmd
.
Its something like vim.nvim_api_set_hl
I looked at material.nvim randomly, and they use vim.api.nvim_set_hl
to set their colors. It seems that the equivalent of the above command is :lua vim.api.nvim_set_hl(0, "Normal", {})
.
This is my neovim visual config:
-- General colors
vim.api.nvim_set_hl( 0, "Normal", { bg = "none" } )
vim.api.nvim_set_hl( 0, "NormalFloat", { bg = "none" } )
vim.api.nvim_set_hl( 0, "NormalNC", { bg = "none" } )
vim.api.nvim_set_hl( 0, "LineNr", { bg = "none" } )
vim.api.nvim_set_hl( 0, "SignColumn", { bg = "none" } )
vim.api.nvim_set_hl( 0, "Folded", { bg = "#4b4b4b" } )
vim.api.nvim_set_hl( 0, "FoldColumn", { bg = "none" } )
vim.api.nvim_set_hl( 0, "Visual", { fg = "#000000", bg = "#de935f" } )
vim.api.nvim_set_hl( 0, "NotifyBackground", { bg = "#000000" } )```
-- Spell checking
vim.api.nvim_set_hl( 0, "SpellLocal", { fg = default } )
vim.api.nvim_set_hl( 0, "SpellRare", { fg = default } )
vim.api.nvim_set_hl( 0, "SpellCap", { fg = "#de935f", italic=true } )
vim.api.nvim_set_hl( 0, "SpellBad", { fg = "#ff0000", italic=true } )
-- Markdown
vim.api.nvim_set_hl( 0, "htmlBold", { bold=true } )
vim.api.nvim_set_hl( 0, "htmlItalic", { italic=true } )
vim.api.nvim_set_hl( 0, "htmlStrike", { fg = "#ff0000", strikethrough=true } )
vim.api.nvim_set_hl( 0, "Normal", { bg = "none" } ) is probably what would work for you.
So I need to disable all the non-treesitter definitions first?
Do you know if there is a way to completely disable the built-in styling?
I have treesitter as well and didn't do anything specific before adding these lines to my config. If you're looking to change "everything" without tweaking each highlight parameter individually you may be interested in this plugin.
I don’t want to make Neovim transparent, though. I have an own colorschme and just don’t want the default colorscheme to be applied.
Ok. If I have interpreted your post correctly you want to not use the default colors for values not defined in your theme (i.e. defaulting to transparency).
I see two options to combine to your theme:
- replacing any default colors using the command above
- using the transparency plugin so any colors not defined in your theme will be transparent
Yeah … so stupid. Why do they force that? If it would take the already defined foreground and background colors of the terminal, fine … but those colors are just made-up nonsense.
Your idea was great, though. I quickfixed that in my colorscheme by adding this line
vim.api.nvim_set_hl(0, 'Normal', {})
And so far this seems to resolve the problematic colors being set.
vim.opt.background = false
vim.opt.guicfg = { background = "transparent", foreground = "#<idiots_color_hex>", }
vim.opt.background = false
Unfortunately no.
E5113: Error while calling lua chunk: vim/_options.lua:0: Invalid option type 'b
oolean' for 'background', should be string
When setting to any string (a literal 'false'
, a hex color string with or without #
, etc.) it prints
E5113: Error while calling lua chunk: vim/_options.lua:0: E474: Invalid argument
vim.opt.guicfg = { background = “transparent”, foreground = “#<idiots_color_hex>”, }
Also no.
E5113: Error while calling lua chunk: vim/_options.lua:0: Invalid option (not found): 'guicfg'
oops thought we were talking about emacs this whole time. sorry ignore me and forget this ever happened.
Neovim