Some syntax highlighting isn't applied when starting with light terminal background and 'flavour="auto"`
- Dominant language
- Lua
- Stars
- 7.6k
- Forks
- 339
- PR merge metrics
- No merged PRs in 30d
Description
### Description
When using a light-background terminal so that neovim automatically sets `background` to `"light"`, some syntax highlighting doesn't work properly. In particular I've found that HTML bold and italic (this includes Markdown as well) don't get applied. I've reproduced this both with lazy.nvim (included `repro.lua`) as well as mini.deps, both with no other plugins or configuration beyond setting up the plugin manager, loading the plugin, and setting the colorscheme.
I've found three workarounds:
* Explicitly set `background` to `"light"` in the config file, either before or after running `colorscheme catppuccin`.
* Explicitly set `flavour="latte"` when loading the catppuccin plugin.
* Don't run the `colorscheme` command from an config file; instead let the default colorscheme load and then set the colorscheme manually once the buffer is opened. (I guess an `autocmd` could do this.)
If I don't apply any of the workarounds and *then* try to change the colorscheme to another theme, or change `background`, the issue persists, even with colorschemes where this issue doesn't normally occur (including the other (dark) catppuccin flavours). The only way I've found to fix it is to quit nvim and apply one of the workarounds as above.
This problem doesn't seem to affect the other theme I tested, Rosé Pine.
### Neovim version
```markdown
NVIM v0.10.2
Build type: RelWithDebInfo
LuaJIT 2.1.1731601260
```
### Terminal and multiplexer
GNOME terminal 3.54.2
### Catppuccin version / branch / rev
faf15ab
### Steps to reproduce
1. Make sure terminal uses a light background so that nvim starts with `background` set to `"light"`.
2. `nvim -u repro.lua`
### Expected behavior

### Actual behavior

### Repro
```Lua
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/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", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"catppuccin/nvim",
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("catppuccin")
-- add anything else here
```
Contributor guide
Research direction
Start by running `nvim -u repro.lua` in a light-background terminal with the reported Catppuccin revision and confirm the missing HTML and Markdown bold and italic highlighting. Compare the behavior after setting `background`, selecting the latte flavour, or changing the colorscheme, and consider the issue resolved when the default `flavour="auto"` path applies those highlights without a workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100