Closed neuromaancer closed 11 months ago
Hi there! The source code may be a bit misleading as I've added convenience methods for definitions. For your particular example, you need to use bold = true
, like so:
config = function()
require("everforest").setup({
on_highlights = function(hl, palette)
hl.Boolean = { fg = palette.purple, bg = palette.none, bold = true }
hl.Number = { fg = palette.purple, bg = palette.none, bold = true }
hl.String = { fg = palette.green, bg = palette.none, bold = true }
hl.Function = { fg = palette.green, bg = palette.none, bold = true }
-- NOTE: Conditional has an optional italics styling, so if you have
-- `italics` set to `true` in setup, then you'll want to add
-- `italic = true` to this table.
hl.Conditional = { fg = palette.red, bg = palette.none, bold = true }
end,
})
end,
Noteworthy here is that you need to have the existing colours (purple fg & empty bg) since the definitions in on_highlights
will override the default definitions. If you want to add an extra styling, you need to add them to the current colours. If you want other special styles (e.g. italic, undercurl etc.), you can add them with italic = true
, undercurl = true
.
I'll update the README to make this clearer.
Thank you for your info! It didn't appear any errors now, but I think in this way, no effect is taken? Below is my full configuration with LazyVim distro:
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "everforest",
},
},
-- everforest
{
"neanias/everforest-nvim",
version = false,
lazy = true,
opts = {
background = "soft",
enable_italic = true,
show_eob = true,
diagnostic_text_highlight = true,
},
config = function()
require("everforest").setup({
on_highlights = function(hl, palette)
hl.Boolean = { fg = palette.purple, bg = palette.none, bold = true }
hl.Number = { fg = palette.purple, bg = palette.none, bold = true }
hl.String = { fg = palette.green, bg = palette.none, italic = true }
hl.Function = { fg = palette.green, bg = palette.none, bold = true }
-- NOTE: Conditional has an optional italics styling, so if you have
-- `italics` set to `true` in setup, then you'll want to add
-- `italic = true` to this table.
hl.Conditional = { fg = palette.red, bg = palette.none, italic = true }
end,
})
end,
},
}
If there are no errors, it should be working 😅 A quick note to say that in everforest-nvim, the setup option for italics is italics = true
, not enable_italic = true
. You can simplify your configuration by putting all the options in opts
:
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "everforest",
},
},
-- everforest
{
"neanias/everforest-nvim",
version = false,
lazy = true,
opts = {
background = "soft",
italics = true,
show_eob = true,
diagnostic_text_highlight = true,
on_highlights = function(hl, palette)
hl.Boolean = { fg = palette.purple, bg = palette.none, bold = true }
hl.Number = { fg = palette.purple, bg = palette.none, bold = true }
hl.String = { fg = palette.green, bg = palette.none, italic = true }
hl.Function = { fg = palette.green, bg = palette.none, bold = true }
-- NOTE: Conditional has an optional italics styling, so if you have
-- `italics` set to `true` in setup, then you'll want to add
-- `italic = true` to this table.
hl.Conditional = { fg = palette.red, bg = palette.none, italic = true }
end,
}
},
}
Oh, yes. However, it still didn't take the effect. For example, if I put hl.String = { fg = palette.green, bg = palette.none, italic = true }
, so "neanias/everforest-nvim"
would be italic, but it shows the normal style. Can you replicate this?
Hmm, let me have a look...
Please let me know if you need any help! I would also contribute to this repo for the README part, at least after this issue. 😸
Ah, I see what this might be. The way that syntax highlighting is set up in this plugin is largely through links, so @string
links to TSString
which doesn't link to String
, but to a colour similar to String
(Aqua
). This is by design. If you want to change the colours for Treesitter strings, you may wish to override either @string
or TSString
:
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "everforest",
},
},
-- everforest
{
"neanias/everforest-nvim",
version = false,
lazy = true,
opts = {
background = "soft",
italics = true,
show_eob = true,
diagnostic_text_highlight = true,
on_highlights = function(hl, _)
-- All of these highlights are linked to their non-bold equivalents by default.
hl.TSBoolean = { link = "PurpleBold" }
hl.TSNumber = { link = "PurpleBold" }
hl.TSString = { link = "AquaBold" }
hl.TSFunction = { link = "GreenBold" }
hl.TSConditional = { link = "RedItalic" }
end,
}
},
}
(If you want to change @string
etc., you'll need to replace hl.TSString = { link = "AquaBold" }
with hl["@string"] = { link = "AquaBold" }
and so on)
But still doesn't work...
require("everforest").setup({
on_highlights = function(hl, palette)
hl.TSBoolean = { link = "PurpleBold" }
hl.Number = { link = "PurpleBold" }
hl["@string"] = { link = "AquaItalic" }
hl.TSString = { link = "AquaItalic" }
hl.Function = { link = "GreenBold" }
hl.TSConditional = { link = "RedItalic" }
end,
Hmm, it works for me... Maybe try this configuration?
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "everforest",
},
},
-- everforest
{
"neanias/everforest-nvim",
version = false,
lazy = true,
config = function()
require("everforest").setup({
background = "soft",
italics = true,
show_eob = true,
diagnostic_text_highlight = true,
on_highlights = function(hl, _)
hl.TSBoolean = { link = "PurpleBold" }
hl.TSNumber = { link = "PurpleBold" }
hl.TSString = { link = "AquaItalic" }
hl.TSFunction = { link = "GreenBold" }
hl.TSConditional = { link = "RedItalic" }
end,
})
end,
},
}
Oh, actually, you'll also want everforest to not be lazy loaded: lazy = false
Okay, it works now! I think the issue is that I put the options in opts
, it doesn't take those options into account. It is strange to me, actually. lazy.nvim
should correctly import those options.
No idea why! One for Folke...
I'd like to change some highlights style by overriding them, I have tried to put
style = "bold
in the highlights group, but it didn't work. After looking at the source code, I guess it might bestylings
instead ofstyle
like below:But it didn't work either, so how can I change the style?