diff --git a/lua/rose-pine/theme.lua b/lua/rose-pine/theme.lua index 3a78242..294ab8b 100644 --- a/lua/rose-pine/theme.lua +++ b/lua/rose-pine/theme.lua @@ -8,7 +8,7 @@ function M.get(config) local theme = {} local groups = config.groups or {} local styles = { - italic = (config.disable_italics and p.none) or 'italic', + italic = not config.disable_italics, vert_split = (config.bold_vert_split and groups.border) or p.none, background = (config.disable_background and p.none) or groups.background, @@ -38,7 +38,7 @@ function M.get(config) diffRemoved = { link = 'DiffDelete' }, Directory = { fg = p.foam, bg = p.none }, -- EndOfBuffer = {}, - ErrorMsg = { fg = p.love, style = 'bold' }, + ErrorMsg = { fg = p.love, bold = true }, FloatBorder = { fg = groups.border }, FloatTitle = { fg = p.muted }, FoldColumn = { fg = p.muted }, @@ -65,10 +65,10 @@ function M.get(config) RedrawDebugRecompose = { fg = '#ffffff', bg = p.love }, Search = { bg = p.highlight_med }, SpecialKey = { fg = p.foam }, - SpellBad = { sp = p.subtle, style = 'undercurl' }, - SpellCap = { sp = p.subtle, style = 'undercurl' }, - SpellLocal = { sp = p.subtle, style = 'undercurl' }, - SpellRare = { sp = p.subtle, style = 'undercurl' }, + SpellBad = { sp = p.subtle, undercurl = true }, + SpellCap = { sp = p.subtle, undercurl = true }, + SpellLocal = { sp = p.subtle, undercurl = true }, + SpellRare = { sp = p.subtle, undercurl = true }, SignColumn = { fg = p.text, bg = styles.background }, StatusLine = { fg = p.subtle, bg = styles.float_background }, StatusLineNC = { fg = p.muted, bg = styles.background }, @@ -87,7 +87,7 @@ function M.get(config) Boolean = { fg = p.rose }, Character = { fg = p.gold }, - Comment = { fg = groups.comment, style = styles.italic }, + Comment = { fg = groups.comment, italic = styles.italic }, Conditional = { fg = p.pine }, Constant = { fg = p.gold }, Debug = { fg = p.rose }, @@ -119,45 +119,45 @@ function M.get(config) Todo = { fg = p.iris }, Type = { fg = p.foam }, Typedef = { fg = p.foam }, - Underlined = { style = 'underline' }, + Underlined = { underline = true }, htmlArg = { fg = p.iris }, - htmlBold = { style = 'bold' }, + htmlBold = { bold = true }, htmlEndTag = { fg = p.subtle }, - htmlH1 = { fg = groups.headings.h1, style = 'bold' }, - htmlH2 = { fg = groups.headings.h2, style = 'bold' }, - htmlH3 = { fg = groups.headings.h3, style = 'bold' }, - htmlH4 = { fg = groups.headings.h4, style = 'bold' }, - htmlH5 = { fg = groups.headings.h5, style = 'bold' }, - htmlItalic = { style = styles.italic }, + htmlH1 = { fg = groups.headings.h1, bold = true }, + htmlH2 = { fg = groups.headings.h2, bold = true }, + htmlH3 = { fg = groups.headings.h3, bold = true }, + htmlH4 = { fg = groups.headings.h4, bold = true }, + htmlH5 = { fg = groups.headings.h5, bold = true }, + htmlItalic = { italic = styles.italic }, htmlLink = { fg = groups.link }, htmlTag = { fg = p.subtle }, htmlTagN = { fg = p.text }, htmlTagName = { fg = p.foam }, markdownDelimiter = { fg = p.subtle }, - markdownH1 = { fg = groups.headings.h1, style = 'bold' }, + markdownH1 = { fg = groups.headings.h1, bold = true }, markdownH1Delimiter = { link = 'markdownH1' }, - markdownH2 = { fg = groups.headings.h2, style = 'bold' }, + markdownH2 = { fg = groups.headings.h2, bold = true }, markdownH2Delimiter = { link = 'markdownH2' }, - markdownH3 = { fg = groups.headings.h3, style = 'bold' }, + markdownH3 = { fg = groups.headings.h3, bold = true }, markdownH3Delimiter = { link = 'markdownH3' }, - markdownH4 = { fg = groups.headings.h4, style = 'bold' }, + markdownH4 = { fg = groups.headings.h4, bold = true }, markdownH4Delimiter = { link = 'markdownH4' }, - markdownH5 = { fg = groups.headings.h5, style = 'bold' }, + markdownH5 = { fg = groups.headings.h5, bold = true }, markdownH5Delimiter = { link = 'markdownH5' }, - markdownH6 = { fg = groups.headings.h6, style = 'bold' }, + markdownH6 = { fg = groups.headings.h6, bold = true }, markdownH6Delimiter = { link = 'markdownH6' }, - markdownLinkText = { fg = groups.link, style = 'underline' }, + markdownLinkText = { fg = groups.link, underline = true }, markdownUrl = { link = 'markdownLinkText' }, - mkdCode = { fg = p.foam, style = styles.italic }, + mkdCode = { fg = p.foam, italic = styles.italic }, mkdCodeDelimiter = { fg = p.rose }, mkdCodeEnd = { fg = p.foam }, mkdCodeStart = { fg = p.foam }, mkdFootnotes = { fg = p.foam }, - mkdID = { fg = p.foam, style = 'underline' }, - mkdInlineURL = { fg = groups.link, style = 'underline' }, + mkdID = { fg = p.foam, underline = true }, + mkdInlineURL = { fg = groups.link, underline = true }, mkdLink = { link = 'mkdInlineURL' }, mkdLinkDef = { link = 'mkdInlineURL' }, mkdListItemLine = { fg = p.text }, @@ -184,10 +184,10 @@ function M.get(config) DiagnosticStatusLineHint = { fg = groups.hint, bg = groups.panel }, DiagnosticStatusLineInfo = { fg = groups.info, bg = groups.panel }, DiagnosticStatusLineWarn = { fg = groups.warn, bg = groups.panel }, - DiagnosticUnderlineError = { sp = groups.error, style = 'undercurl' }, - DiagnosticUnderlineHint = { sp = groups.hint, style = 'undercurl' }, - DiagnosticUnderlineInfo = { sp = groups.info, style = 'undercurl' }, - DiagnosticUnderlineWarn = { sp = groups.warn, style = 'undercurl' }, + DiagnosticUnderlineError = { sp = groups.error, undercurl = true }, + DiagnosticUnderlineHint = { sp = groups.hint, undercurl = true }, + DiagnosticUnderlineInfo = { sp = groups.info, undercurl = true }, + DiagnosticUnderlineWarn = { sp = groups.warn, undercurl = true }, DiagnosticVirtualTextError = { fg = groups.error }, DiagnosticVirtualTextHint = { fg = groups.hint }, DiagnosticVirtualTextInfo = { fg = groups.info }, @@ -226,9 +226,9 @@ function M.get(config) -- TSNone = {}, TSNumber = { link = 'Number' }, TSOperator = { fg = p.subtle }, - TSParameter = { fg = p.iris, style = styles.italic }, + TSParameter = { fg = p.iris, italic = styles.italic }, -- TSParameterReference = {}, - TSProperty = { fg = p.iris, style = styles.italic }, + TSProperty = { fg = p.iris, italic = styles.italic }, TSPunctBracket = { fg = groups.punctuation }, TSPunctDelimiter = { fg = groups.punctuation }, TSPunctSpecial = { fg = groups.punctuation }, @@ -242,12 +242,12 @@ function M.get(config) TSTag = { fg = p.foam }, TSTagDelimiter = { fg = p.subtle }, TSText = { fg = p.text }, - TSTitle = { fg = groups.headings.h1, style = 'bold' }, + TSTitle = { fg = groups.headings.h1, bold = true }, TSType = { link = 'Type' }, -- TSTypeBuiltin = {}, TSURI = { fg = groups.link }, -- TSUnderline = {}, - TSVariable = { fg = p.text, style = styles.italic }, + TSVariable = { fg = p.text, italic = styles.italic }, TSVariableBuiltin = { fg = p.love }, -- Treesitter @@ -270,8 +270,8 @@ function M.get(config) ['@namespace'] = { link = 'Include' }, ['@number'] = { link = 'Number' }, ['@operator'] = { fg = p.subtle }, - ['@parameter'] = { fg = p.iris, style = styles.italic }, - ['@property'] = { fg = p.iris, style = styles.italic }, + ['@parameter'] = { fg = p.iris, italic = styles.italic }, + ['@property'] = { fg = p.iris, italic = styles.italic }, ['@punctuation.bracket'] = { fg = groups.punctuation }, ['@punctuation.delimiter'] = { fg = groups.punctuation }, ['@punctuation.special'] = { fg = groups.punctuation }, @@ -290,14 +290,14 @@ function M.get(config) ['@text.math'] = { link = 'Special' }, ['@text.environment'] = { link = 'Macro' }, ['@text.environment.name'] = { link = 'Type' }, - ['@text.title'] = { fg = groups.headings.h1, style = 'bold' }, + ['@text.title'] = { fg = groups.headings.h1, bold = true }, ['@text.uri'] = { fg = groups.link }, ['@text.note'] = { link = 'SpecialComment' }, ['@text.warning'] = { link = 'Todo' }, ['@text.danger'] = { link = 'WarningMsg' }, ['@todo'] = { link = 'Todo' }, ['@type'] = { link = 'Type' }, - ['@variable'] = { fg = p.text, style = styles.italic }, + ['@variable'] = { fg = p.text, italic = styles.italic }, ['@variable.builtin'] = { fg = p.love }, -- vim.lsp.buf.document_highlight() @@ -381,9 +381,9 @@ function M.get(config) -- hrsh7th/nvim-cmp CmpItemAbbr = { fg = p.subtle }, - CmpItemAbbrDeprecated = { fg = p.subtle, style = 'strikethrough' }, - CmpItemAbbrMatch = { fg = p.text, style = 'bold' }, - CmpItemAbbrMatchFuzzy = { fg = p.text, style = 'bold' }, + CmpItemAbbrDeprecated = { fg = p.subtle, strikethrough = true }, + CmpItemAbbrMatch = { fg = p.text, bold = true }, + CmpItemAbbrMatchFuzzy = { fg = p.text, bold = true }, CmpItemKind = { fg = p.iris }, CmpItemKindClass = { fg = p.gold }, CmpItemKindFunction = { fg = p.iris }, @@ -401,46 +401,46 @@ function M.get(config) -- vimwiki/vimwiki VimwikiHR = { fg = p.subtle }, - VimwikiHeader1 = { fg = groups.headings.h1, style = 'bold' }, - VimwikiHeader2 = { fg = groups.headings.h2, style = 'bold' }, - VimwikiHeader3 = { fg = groups.headings.h3, style = 'bold' }, - VimwikiHeader4 = { fg = groups.headings.h4, style = 'bold' }, - VimwikiHeader5 = { fg = groups.headings.h5, style = 'bold' }, - VimwikiHeader6 = { fg = groups.headings.h6, style = 'bold' }, + VimwikiHeader1 = { fg = groups.headings.h1, bold = true }, + VimwikiHeader2 = { fg = groups.headings.h2, bold = true }, + VimwikiHeader3 = { fg = groups.headings.h3, bold = true }, + VimwikiHeader4 = { fg = groups.headings.h4, bold = true }, + VimwikiHeader5 = { fg = groups.headings.h5, bold = true }, + VimwikiHeader6 = { fg = groups.headings.h6, bold = true }, VimwikiHeaderChar = { fg = p.pine }, - VimwikiLink = { fg = groups.link, style = 'underline' }, + VimwikiLink = { fg = groups.link, underline = true }, VimwikiList = { fg = p.iris }, VimwikiNoExistsLink = { fg = p.love }, -- nvim-neorg/neorg - NeorgHeading1Prefix = { fg = groups.headings.h1, style = 'bold' }, + NeorgHeading1Prefix = { fg = groups.headings.h1, bold = true }, NeorgHeading1Title = { link = 'NeorgHeading1Prefix' }, - NeorgHeading2Prefix = { fg = groups.headings.h2, style = 'bold' }, + NeorgHeading2Prefix = { fg = groups.headings.h2, bold = true }, NeorgHeading2Title = { link = 'NeorgHeading2Prefix' }, - NeorgHeading3Prefix = { fg = groups.headings.h3, style = 'bold' }, + NeorgHeading3Prefix = { fg = groups.headings.h3, bold = true }, NeorgHeading3Title = { link = 'NeorgHeading3Prefix' }, - NeorgHeading4Prefix = { fg = groups.headings.h4, style = 'bold' }, + NeorgHeading4Prefix = { fg = groups.headings.h4, bold = true }, NeorgHeading4Title = { link = 'NeorgHeading4Prefix' }, - NeorgHeading5Prefix = { fg = groups.headings.h5, style = 'bold' }, + NeorgHeading5Prefix = { fg = groups.headings.h5, bold = true }, NeorgHeading5Title = { link = 'NeorgHeading5Prefix' }, - NeorgHeading6Prefix = { fg = groups.headings.h6, style = 'bold' }, + NeorgHeading6Prefix = { fg = groups.headings.h6, bold = true }, NeorgHeading6Title = { link = 'NeorgHeading6Prefix' }, - NeorgMarkerTitle = { fg = p.text, style = 'bold' }, + NeorgMarkerTitle = { fg = p.text, bold = true }, -- tami5/lspsaga.nvim (fork of glepnir/lspsaga.nvim) DefinitionCount = { fg = p.rose }, DefinitionIcon = { fg = p.rose }, - DefintionPreviewTitle = { fg = p.rose, style = 'bold' }, + DefintionPreviewTitle = { fg = p.rose, bold = true }, LspFloatWinBorder = { fg = groups.border }, LspFloatWinNormal = { bg = groups.background }, LspSagaAutoPreview = { fg = p.subtle }, LspSagaCodeActionBorder = { fg = groups.border }, LspSagaCodeActionContent = { fg = p.foam }, - LspSagaCodeActionTitle = { fg = p.gold, style = 'bold' }, + LspSagaCodeActionTitle = { fg = p.gold, bold = true }, LspSagaCodeActionTruncateLine = { link = 'LspSagaCodeActionBorder' }, LspSagaDefPreviewBorder = { fg = groups.border }, LspSagaDiagnosticBorder = { fg = groups.border }, - LspSagaDiagnosticHeader = { fg = p.gold, style = 'bold' }, + LspSagaDiagnosticHeader = { fg = p.gold, bold = true }, LspSagaDiagnosticTruncateLine = { link = 'LspSagaDiagnosticBorder' }, LspSagaDocTruncateLine = { link = 'LspSagaHoverBorder' }, LspSagaFinderSelection = { fg = p.gold }, @@ -498,7 +498,7 @@ function M.get(config) DapUIThread = { fg = p.gold }, DapUIWatchesValue = { link = 'DapUIThread' }, DapUIBreakpointsInfo = { link = 'DapUIThread' }, - DapUIBreakpointsCurrentLine = { fg = p.gold, style = 'bold' }, + DapUIBreakpointsCurrentLine = { fg = p.gold, bold = true }, DapUIWatchesEmpty = { fg = p.love }, DapUIWatchesError = { link = 'DapUIWatchesEmpty' }, DapUIBreakpointsDisabledLine = { fg = p.muted }, @@ -510,7 +510,7 @@ function M.get(config) DapUIFloatBorder = { link = 'DapUIBreakpointsPath' }, DapUIStoppedThread = { link = 'DapUIBreakpointsPath' }, DapUIDecoration = { link = 'DapUIBreakpointsPath' }, - DapUIModifiedValue = { fg = p.foam, style = 'bold' }, + DapUIModifiedValue = { fg = p.foam, bold = true }, -- glepnir/dashboard-nvim DashboardShortcut = { fg = p.love }, diff --git a/lua/rose-pine/util.lua b/lua/rose-pine/util.lua index 2bfdf85..9ee34e0 100644 --- a/lua/rose-pine/util.lua +++ b/lua/rose-pine/util.lua @@ -52,16 +52,12 @@ end ---@param group string ---@param color table util.highlight = function(group, color) - local style = color.style and 'gui=' .. color.style or 'gui=NONE' - local fg = color.fg and 'guifg=' .. parse_color(color.fg) or 'guifg=NONE' - local bg = color.bg and 'guibg=' .. parse_color(color.bg) or 'guibg=NONE' - local sp = color.sp and 'guisp=' .. parse_color(color.sp) or '' + local fg = color.fg and parse_color(color.fg) or 'none' + local bg = color.bg and parse_color(color.bg) or 'none' + local sp = color.sp and parse_color(color.sp) or '' - vim.cmd(string.format('highlight %s %s %s %s %s', group, style, fg, bg, sp)) - - if color.link then - vim.cmd(string.format('highlight! link %s %s', group, color.link)) - end + color = vim.tbl_extend('force', color, { fg = fg, bg = bg, sp = sp }) + vim.api.nvim_set_hl(0, group, color) end return util