mirror of
https://github.com/rose-pine/neovim.git
synced 2025-10-15 12:38:53 +02:00
feat(syntax)!: add additional syntax styles.
Introduce new styles options in order to be able to customize a bit more the rose pine colorscheme syntax and not depend exclusively on italic and bold style options. A new utility function was added in order to add a custom hl property style for custom syntax styles.
This commit is contained in:
parent
c52167563e
commit
4db28ae644
3 changed files with 23 additions and 9 deletions
|
|
@ -179,7 +179,7 @@ local function set_highlights()
|
||||||
|
|
||||||
Boolean = { fg = palette.rose },
|
Boolean = { fg = palette.rose },
|
||||||
Character = { fg = palette.gold },
|
Character = { fg = palette.gold },
|
||||||
Comment = { fg = palette.subtle, italic = styles.italic },
|
Comment = { fg = palette.subtle, style = styles.comments },
|
||||||
Conditional = { fg = palette.pine },
|
Conditional = { fg = palette.pine },
|
||||||
Constant = { fg = palette.gold },
|
Constant = { fg = palette.gold },
|
||||||
Debug = { fg = palette.rose },
|
Debug = { fg = palette.rose },
|
||||||
|
|
@ -188,10 +188,10 @@ local function set_highlights()
|
||||||
Error = { fg = palette.love },
|
Error = { fg = palette.love },
|
||||||
Exception = { fg = palette.pine },
|
Exception = { fg = palette.pine },
|
||||||
Float = { fg = palette.gold },
|
Float = { fg = palette.gold },
|
||||||
Function = { fg = palette.rose },
|
Function = { fg = palette.rose, style = styles.functions },
|
||||||
Identifier = { fg = palette.text },
|
Identifier = { fg = palette.text, style = styles.variables },
|
||||||
Include = { fg = palette.pine },
|
Include = { fg = palette.pine },
|
||||||
Keyword = { fg = palette.pine },
|
Keyword = { fg = palette.pine, style = styles.keywords },
|
||||||
Label = { fg = palette.foam },
|
Label = { fg = palette.foam },
|
||||||
LspCodeLens = { fg = palette.subtle },
|
LspCodeLens = { fg = palette.subtle },
|
||||||
LspCodeLensSeparator = { fg = palette.muted },
|
LspCodeLensSeparator = { fg = palette.muted },
|
||||||
|
|
@ -266,9 +266,9 @@ local function set_highlights()
|
||||||
mkdURL = { link = "markdownUrl" },
|
mkdURL = { link = "markdownUrl" },
|
||||||
|
|
||||||
--- Identifiers
|
--- Identifiers
|
||||||
["@variable"] = { fg = palette.text, italic = styles.italic },
|
["@variable"] = { fg = palette.text, style = styles.variables },
|
||||||
["@variable.builtin"] = { fg = palette.love, bold = styles.bold },
|
["@variable.builtin"] = { fg = palette.love },
|
||||||
["@variable.parameter"] = { fg = palette.iris, italic = styles.italic },
|
["@variable.parameter"] = { fg = palette.iris },
|
||||||
["@variable.member"] = { fg = palette.foam },
|
["@variable.member"] = { fg = palette.foam },
|
||||||
|
|
||||||
["@constant"] = { fg = palette.gold },
|
["@constant"] = { fg = palette.gold },
|
||||||
|
|
@ -303,7 +303,7 @@ local function set_highlights()
|
||||||
-- ["@type.qualifier"] = {},
|
-- ["@type.qualifier"] = {},
|
||||||
|
|
||||||
-- ["@attribute"] = {},
|
-- ["@attribute"] = {},
|
||||||
["@property"] = { fg = palette.foam, italic = styles.italic },
|
["@property"] = { fg = palette.foam, style = styles.variables },
|
||||||
|
|
||||||
--- Functions
|
--- Functions
|
||||||
["@function"] = { fg = palette.rose },
|
["@function"] = { fg = palette.rose },
|
||||||
|
|
@ -857,7 +857,7 @@ local function set_highlights()
|
||||||
if highlight.blend ~= nil and (highlight.blend >= 0 and highlight.blend <= 100) and highlight.bg ~= nil then
|
if highlight.blend ~= nil and (highlight.blend >= 0 and highlight.blend <= 100) and highlight.bg ~= nil then
|
||||||
highlight.bg = utilities.blend(highlight.bg, highlight.blend_on or palette.base, highlight.blend / 100)
|
highlight.bg = utilities.blend(highlight.bg, highlight.blend_on or palette.base, highlight.blend / 100)
|
||||||
end
|
end
|
||||||
vim.api.nvim_set_hl(0, group, highlight)
|
utilities.highlight(group, highlight)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Terminal
|
--- Terminal
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ config.options = {
|
||||||
},
|
},
|
||||||
|
|
||||||
styles = {
|
styles = {
|
||||||
|
comments = { italic = true },
|
||||||
|
functions = {},
|
||||||
|
keywords = { italic = true },
|
||||||
|
variables = {},
|
||||||
bold = true,
|
bold = true,
|
||||||
italic = true,
|
italic = true,
|
||||||
transparency = false,
|
transparency = false,
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,14 @@ function utilities.blend(fg, bg, alpha)
|
||||||
return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2), blend_channel(3))
|
return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2), blend_channel(3))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param group string
|
||||||
|
---@param hl table<string, boolean>
|
||||||
|
function utilities.highlight(group, hl)
|
||||||
|
if hl.style then
|
||||||
|
hl = vim.tbl_extend("force", hl, hl.style)
|
||||||
|
hl.style = nil
|
||||||
|
end
|
||||||
|
vim.api.nvim_set_hl(0, group, hl)
|
||||||
|
end
|
||||||
|
|
||||||
return utilities
|
return utilities
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue