diff --git a/lua/rose-pine/config.lua b/lua/rose-pine/config.lua index 5fc752d..6b3ac12 100644 --- a/lua/rose-pine/config.lua +++ b/lua/rose-pine/config.lua @@ -1,26 +1,48 @@ local palette = require('rose-pine.palette') +local function opt(key, default) + key = 'rose_pine_' .. key + + if vim.g[key] == nil then + return default + end + + if vim.g[key] == 0 or vim.g[key] == false then + return false + end + + return vim.g[key] +end + local config = { - bold_vert_split = vim.g.rose_pine_bold_verical_split_line or false, - inactive_background = vim.g.rose_pine_inactive_background or false, - no_background = vim.g.rose_pine_disable_background or false, - no_float_background = vim.g.rose_pine_disable_float_background or false, - no_italics = vim.g.rose_pine_disable_italics or false, + variant = opt('variant', 'main'), + + bold_vertical_split_line = opt('bold_vertical_split_line', false), + disable_italics = opt('disable_italics', false), + disable_background = opt('disable_background', false), + disable_float_background = opt('disable_float_background', false), + inactive_background = opt('inactive_background', false), + colors = { - punctuation = palette.subtle, - comment = palette.subtle, border = palette.highlight_med, + comment = palette.muted, + link = palette.iris, + punctuation = palette.subtle, + + error = palette.love, hint = palette.iris, info = palette.foam, warn = palette.gold, - error = palette.love, - -- TODO: Expose these once matched with syntax and cmp kind - -- variable = '', - -- class = '', - -- interface = '', - -- ['function'] = '', - -- method = '', + git_add = palette.foam, + git_change = palette.rose, + git_delete = palette.love, + git_dirty = palette.rose, + git_ignore = palette.muted, + git_merge = palette.iris, + git_rename = palette.pine, + git_stage = palette.iris, + git_text = palette.rose, ---@type string|table headings = { diff --git a/lua/rose-pine/palette.lua b/lua/rose-pine/palette.lua index 25216f5..0b24973 100644 --- a/lua/rose-pine/palette.lua +++ b/lua/rose-pine/palette.lua @@ -15,6 +15,7 @@ local variants = { highlight_low = '#21202e', highlight_med = '#403d52', highlight_high = '#524f67', + opacity = 0.1, }, moon = { base = '#232136', @@ -32,6 +33,7 @@ local variants = { highlight_low = '#2a283e', highlight_med = '#44415a', highlight_high = '#56526e', + opacity = 0.1, }, dawn = { base = '#faf4ed', @@ -49,6 +51,7 @@ local variants = { highlight_low = '#f4ede8', highlight_med = '#dfdad9', highlight_high = '#cecacd', + opacity = 0.05, }, } diff --git a/lua/rose-pine/theme.lua b/lua/rose-pine/theme.lua index af212f6..ab8e68c 100644 --- a/lua/rose-pine/theme.lua +++ b/lua/rose-pine/theme.lua @@ -1,215 +1,194 @@ +local palette = require('rose-pine.palette') local config = require('rose-pine.config') local util = require('rose-pine.util') -local p = require('rose-pine.palette') -local c = config.colors --- TODO: Refactor `maybe` logic -local maybe_inactive_background = p.none -local maybe_background = p.base -local maybe_float_background = p.surface +local group = config.colors + local maybe_italic = 'italic' -local maybe_bold_vert_split = { fg = p.overlay } - -if config.bold_vert_split then - maybe_bold_vert_split = { fg = p.surface, bg = p.surface } -end - -if config.inactive_background then - maybe_inactive_background = p.surface -end - -if config.no_background then - maybe_background = p.none -end - -if config.no_float_background then - maybe_float_background = p.none -end - -if config.no_italics then +if config.disable_italics == true then maybe_italic = nil end +local background = config.disable_background and palette.base or palette.none +local float_background = config.disable_float_background and palette.surface or palette.none +local inactive_background = config.inactive_background + and util.blend('#000000', palette.base, palette.opacity) + or palette.none +local vert_split_background = config.bold_vertical_split_line and palette.overlay or palette.none + local theme = { - ColorColumn = { bg = p.highlight_high }, - Conceal = { bg = p.none }, + ColorColumn = { bg = palette.highlight_high }, + Conceal = { bg = palette.none }, -- Cursor = {}, - CursorColumn = { bg = p.highlight_med }, + CursorColumn = { bg = group.border }, -- CursorIM = {}, - CursorLine = { bg = p.highlight_low }, - CursorLineNr = { fg = p.text }, - DarkenedPanel = { bg = p.surface }, - DarkenedStatusline = { bg = p.surface }, - -- TODO: Allow diff overrides. This is a good reason to refactor our config logic to allow setting both fg and bg - DiffAdd = { bg = util.blend(p.foam, p.base, 0.5) }, - DiffChange = { bg = p.overlay }, - DiffDelete = { bg = util.blend(p.love, p.base, 0.5) }, - DiffText = { bg = util.blend(p.rose, p.base, 0.5) }, + CursorLine = { bg = palette.highlight_low }, + CursorLineNr = { fg = palette.text }, + DarkenedPanel = { bg = palette.surface }, + DarkenedStatusline = { bg = palette.surface }, + DiffAdd = { bg = util.blend(group.git_add, palette.base, 0.5) }, + DiffChange = { bg = palette.overlay }, + DiffDelete = { bg = util.blend(group.git_delete, palette.base, 0.5) }, + DiffText = { bg = util.blend(group.git_text, palette.base, 0.5) }, diffAdded = { link = 'DiffAdd' }, diffChanged = { link = 'DiffChange' }, diffRemoved = { link = 'DiffDelete' }, - Directory = { fg = p.foam, bg = p.none }, + Directory = { fg = palette.foam, bg = palette.none }, -- EndOfBuffer = {}, - ErrorMsg = { fg = p.love, style = 'bold' }, - FloatBorder = { fg = c.border }, - FoldColumn = { fg = p.muted }, - Folded = { fg = p.text, bg = p.surface }, - IncSearch = { bg = p.highlight_high }, - LineNr = { fg = p.muted }, - MatchParen = { fg = p.text, bg = p.highlight_med }, - ModeMsg = { fg = p.subtle }, - MoreMsg = { fg = p.iris }, - NonText = { fg = p.muted }, - Normal = { fg = p.text, bg = maybe_background }, - NormalNC = { fg = p.text, bg = maybe_inactive_background }, - NormalFloat = { fg = p.text, bg = maybe_float_background }, - Pmenu = { fg = p.subtle, bg = maybe_float_background }, - PmenuSbar = { bg = p.overlay }, - PmenuSel = { fg = p.text, bg = p.overlay }, - PmenuThumb = { bg = p.muted }, - Question = { fg = p.gold }, + ErrorMsg = { fg = palette.love, style = 'bold' }, + FloatBorder = { fg = group.border }, + FoldColumn = { fg = palette.muted }, + Folded = { fg = palette.text, bg = palette.surface }, + IncSearch = { bg = palette.highlight_high }, + LineNr = { fg = palette.muted }, + MatchParen = { fg = palette.text, bg = palette.highlight_med }, + ModeMsg = { fg = palette.subtle }, + MoreMsg = { fg = palette.iris }, + NonText = { fg = palette.muted }, + Normal = { fg = palette.text, bg = background }, + NormalNC = { fg = palette.text, bg = inactive_background }, + NormalFloat = { fg = palette.text, bg = float_background }, + Pmenu = { fg = palette.subtle, bg = float_background }, + PmenuSbar = { bg = palette.overlay }, + PmenuSel = { fg = palette.text, bg = palette.overlay }, + PmenuThumb = { bg = palette.muted }, + Question = { fg = palette.gold }, -- QuickFixLine = {}, - Search = { bg = p.highlight_med }, - SpecialKey = { fg = p.foam }, - SpellBad = { style = 'undercurl', sp = p.love }, - SpellCap = { style = 'undercurl', sp = p.subtle }, - SpellLocal = { style = 'undercurl', sp = p.subtle }, - SpellRare = { style = 'undercurl', sp = p.subtle }, - SignColumn = { fg = p.text, bg = maybe_background }, - StatusLine = { fg = p.subtle, bg = p.surface }, - StatusLineNC = { fg = p.muted, bg = p.surface }, + Search = { bg = palette.highlight_med }, + SpecialKey = { fg = palette.foam }, + SpellBad = { sp = palette.love, style = 'undercurl' }, + SpellCap = { sp = palette.subtle, style = 'undercurl' }, + SpellLocal = { sp = palette.subtle, style = 'undercurl' }, + SpellRare = { sp = palette.subtle, style = 'undercurl' }, + SignColumn = { fg = palette.text, bg = background }, + StatusLine = { fg = palette.subtle, bg = palette.surface }, + StatusLineNC = { fg = palette.muted, bg = palette.base }, -- StatusLineTerm = {}, -- StatusLineTermNC = {}, - TabLine = { fg = p.subtle, bg = p.overlay }, - TabLineFill = { bg = p.surface }, - TabLineSel = { fg = p.text, bg = p.muted }, - Title = { fg = p.text }, - VertSplit = maybe_bold_vert_split, - Visual = { bg = p.highlight_med }, + TabLine = { fg = palette.subtle, bg = palette.overlay }, + TabLineFill = { bg = palette.surface }, + TabLineSel = { fg = palette.text, bg = palette.muted }, + Title = { fg = palette.text }, + VertSplit = { fg = palette.overlay, bg = vert_split_background }, + Visual = { bg = palette.highlight_med }, -- VisualNOS = {}, - WarningMsg = { fg = p.gold }, + WarningMsg = { fg = palette.gold }, -- Whitespace = {}, -- WildMenu = {}, - Boolean = { fg = p.gold }, - Character = { fg = p.gold }, - Comment = { - fg = c.comment, - style = maybe_italic, - }, - Conditional = { fg = p.pine }, - Constant = { fg = p.gold }, - Debug = { fg = p.rose }, - Define = { fg = p.iris }, - Delimiter = { fg = p.subtle }, - Error = { fg = p.love }, - Exception = { fg = p.pine }, - Float = { fg = p.gold }, - Function = { fg = p.rose }, - Identifier = { fg = p.rose }, - -- Ignore = { fg = '' }, - Include = { fg = p.iris }, - Keyword = { fg = p.pine }, - Label = { fg = p.foam }, - Macro = { fg = p.iris }, - Number = { fg = p.gold }, - Operator = { fg = p.subtle }, - PreCondit = { fg = p.iris }, - PreProc = { fg = p.iris }, - Repeat = { fg = p.pine }, - Special = { fg = p.rose }, - SpecialChar = { fg = p.rose }, - SpecialComment = { fg = p.iris }, - Statement = { fg = p.pine }, - StorageClass = { fg = p.foam }, - String = { fg = p.gold }, - Structure = { fg = p.foam }, - Tag = { fg = p.rose }, - Todo = { fg = p.iris }, - Type = { fg = p.foam }, - Typedef = { fg = p.foam }, - Underlined = { fg = p.foam, style = 'underline' }, + Boolean = { fg = palette.gold }, + Character = { fg = palette.gold }, + Comment = { fg = group.comment, style = maybe_italic }, + Conditional = { fg = palette.pine }, + Constant = { fg = palette.gold }, + Debug = { fg = palette.rose }, + Define = { fg = palette.iris }, + Delimiter = { fg = palette.subtle }, + Error = { fg = palette.love }, + Exception = { fg = palette.pine }, + Float = { fg = palette.gold }, + Function = { fg = palette.rose }, + Identifier = { fg = palette.rose }, + -- Ignore = {}, + Include = { fg = palette.iris }, + Keyword = { fg = palette.pine }, + Label = { fg = palette.foam }, + Macro = { fg = palette.iris }, + Number = { fg = palette.gold }, + Operator = { fg = palette.subtle }, + PreCondit = { fg = palette.iris }, + PreProc = { fg = palette.iris }, + Repeat = { fg = palette.pine }, + Special = { fg = palette.rose }, + SpecialChar = { fg = palette.rose }, + SpecialComment = { fg = palette.iris }, + Statement = { fg = palette.pine }, + StorageClass = { fg = palette.foam }, + String = { fg = palette.gold }, + Structure = { fg = palette.foam }, + Tag = { fg = palette.rose }, + Todo = { fg = palette.iris }, + Type = { fg = palette.foam }, + Typedef = { fg = palette.foam }, + Underlined = { fg = palette.foam, style = 'underline' }, - htmlArg = { fg = p.iris }, - htmlBold = { fg = p.text, style = 'bold' }, - htmlEndTag = { fg = p.subtle }, - htmlH1 = { fg = c.headings.h1, style = 'bold' }, - htmlH2 = { fg = c.headings.h2, style = 'bold' }, - htmlH3 = { fg = c.headings.h3, style = 'bold' }, - htmlH4 = { fg = c.headings.h4, style = 'bold' }, - htmlH5 = { fg = c.headings.h5, style = 'bold' }, - htmlItalic = { fg = p.text, style = maybe_italic }, - htmlLink = { fg = p.text }, - htmlTag = { fg = p.subtle }, - htmlTagN = { fg = p.text }, - htmlTagName = { fg = p.foam }, + htmlArg = { fg = palette.iris }, + htmlBold = { fg = palette.text, style = 'bold' }, + htmlEndTag = { fg = palette.subtle }, + htmlH1 = { fg = group.headings.h1, style = 'bold' }, + htmlH2 = { fg = group.headings.h2, style = 'bold' }, + htmlH3 = { fg = group.headings.h3, style = 'bold' }, + htmlH4 = { fg = group.headings.h4, style = 'bold' }, + htmlH5 = { fg = group.headings.h5, style = 'bold' }, + htmlItalic = { fg = palette.text, style = maybe_italic }, + htmlLink = { fg = group.link }, + htmlTag = { fg = palette.subtle }, + htmlTagN = { fg = palette.text }, + htmlTagName = { fg = palette.foam }, - markdownH1 = { fg = c.headings.h1, style = 'bold' }, - markdownH1Delimiter = { fg = c.headings.h1 }, - markdownH2 = { fg = c.headings.h2, style = 'bold' }, - markdownH2Delimiter = { fg = c.headings.h2 }, - markdownH3 = { fg = c.headings.h3, style = 'bold' }, - markdownH3Delimiter = { fg = c.headings.h3 }, - markdownH4 = { fg = c.headings.h4, style = 'bold' }, - markdownH4Delimiter = { fg = c.headings.h4 }, - markdownH5 = { fg = c.headings.h5, style = 'bold' }, - markdownH5Delimiter = { fg = c.headings.h5 }, - markdownH6 = { fg = c.headings.h6, style = 'bold' }, - markdownH6Delimiter = { fg = c.headings.h6 }, - markdownDelimiter = { fg = p.subtle }, - markdownLinkText = { fg = p.iris, style = 'underline' }, - markdownUrl = { fg = p.iris, style = 'underline' }, - mkdCode = { fg = p.foam, style = maybe_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 = p.foam, style = 'underline' }, - mkdLink = { fg = p.rose, style = 'bold' }, - mkdLinkDef = { fg = p.rose, style = 'bold' }, - mkdListItemLine = { fg = p.text }, - mkdRule = { fg = p.subtle }, - mkdURL = { fg = p.foam, style = 'underline' }, + markdownH1 = { fg = group.headings.h1, style = 'bold' }, + markdownH1Delimiter = { fg = group.headings.h1 }, + markdownH2 = { fg = group.headings.h2, style = 'bold' }, + markdownH2Delimiter = { fg = group.headings.h2 }, + markdownH3 = { fg = group.headings.h3, style = 'bold' }, + markdownH3Delimiter = { fg = group.headings.h3 }, + markdownH4 = { fg = group.headings.h4, style = 'bold' }, + markdownH4Delimiter = { fg = group.headings.h4 }, + markdownH5 = { fg = group.headings.h5, style = 'bold' }, + markdownH5Delimiter = { fg = group.headings.h5 }, + markdownH6 = { fg = group.headings.h6, style = 'bold' }, + markdownH6Delimiter = { fg = group.headings.h6 }, + markdownDelimiter = { fg = palette.subtle }, + markdownLinkText = { fg = group.link, style = 'underline' }, + markdownUrl = { fg = palette.iris, style = 'underline' }, + mkdCode = { fg = palette.foam, style = maybe_italic }, + mkdCodeDelimiter = { fg = palette.rose }, + mkdCodeEnd = { fg = palette.foam }, + mkdCodeStart = { fg = palette.foam }, + mkdFootnotes = { fg = palette.foam }, + mkdID = { fg = palette.foam, style = 'underline' }, + mkdInlineURL = { fg = group.link, style = 'underline' }, + mkdLink = { fg = group.link, style = 'underline' }, + mkdLinkDef = { fg = group.link, style = 'underline' }, + mkdListItemLine = { fg = palette.text }, + mkdRule = { fg = palette.subtle }, + mkdURL = { fg = palette.foam, style = 'underline' }, -- Fix background mismatch if user sets custom float background -- In LSP hover float: (paramater) -- ^ ^ - typescriptParens = { bg = p.none }, + typescriptParens = { bg = palette.none }, - DiagnosticHint = { fg = c.hint }, - DiagnosticInfo = { fg = c.info }, + DiagnosticHint = { fg = group.hint }, + DiagnosticInfo = { fg = group.info }, DiagnosticInformation = { link = 'DiagnosticInfo' }, - DiagnosticWarn = { fg = c.warn }, + DiagnosticWarn = { fg = group.warn }, DiagnosticWarning = { link = 'DiagnosticWarn' }, - DiagnosticError = { fg = c.error }, - DiagnosticDefaultHint = { fg = c.hint }, - DiagnosticDefaultInfo = { fg = c.info }, - DiagnosticDefaultWarn = { fg = c.warn }, - DiagnosticDefaultError = { fg = c.error }, - DiagnosticFloatingHint = { fg = c.hint }, - DiagnosticFloatingInfo = { fg = c.info }, - DiagnosticFloatingWarn = { fg = c.warn }, - DiagnosticFloatingError = { fg = c.error }, - DiagnosticSignHint = { fg = c.hint }, - DiagnosticSignInfo = { fg = c.info }, - DiagnosticSignWarn = { fg = c.warn }, - DiagnosticSignError = { fg = c.error }, - DiagnosticUnderlineHint = { style = 'undercurl', sp = c.hint }, - DiagnosticUnderlineInfo = { style = 'undercurl', sp = c.info }, - DiagnosticUnderlineWarn = { style = 'undercurl', sp = c.warn }, - DiagnosticUnderlineError = { - style = 'undercurl', - sp = c.error, - }, - DiagnosticVirtualTextHint = { fg = c.hint }, - DiagnosticVirtualTextInfo = { fg = c.info }, - DiagnosticVirtualTextWarn = { fg = c.warn }, - DiagnosticVirtualTextError = { fg = c.error }, + DiagnosticError = { fg = group.error }, + DiagnosticDefaultHint = { fg = group.hint }, + DiagnosticDefaultInfo = { fg = group.info }, + DiagnosticDefaultWarn = { fg = group.warn }, + DiagnosticDefaultError = { fg = group.error }, + DiagnosticFloatingHint = { fg = group.hint }, + DiagnosticFloatingInfo = { fg = group.info }, + DiagnosticFloatingWarn = { fg = group.warn }, + DiagnosticFloatingError = { fg = group.error }, + DiagnosticSignHint = { fg = group.hint }, + DiagnosticSignInfo = { fg = group.info }, + DiagnosticSignWarn = { fg = group.warn }, + DiagnosticSignError = { fg = group.error }, + DiagnosticUnderlineHint = { sp = group.hint, style = 'undercurl' }, + DiagnosticUnderlineInfo = { sp = group.info, style = 'undercurl' }, + DiagnosticUnderlineWarn = { sp = group.warn, style = 'undercurl' }, + DiagnosticUnderlineError = { sp = group.error, style = 'undercurl' }, + DiagnosticVirtualTextHint = { fg = group.hint }, + DiagnosticVirtualTextInfo = { fg = group.info }, + DiagnosticVirtualTextWarn = { fg = group.warn }, + DiagnosticVirtualTextError = { fg = group.error }, - LspReferenceText = { fg = p.rose, bg = p.highlight_med }, - LspReferenceRead = { fg = p.rose, bg = p.highlight_med }, - LspReferenceWrite = { fg = p.rose, bg = p.highlight_med }, + LspReferenceText = { fg = palette.rose, bg = palette.highlight_med }, + LspReferenceRead = { fg = palette.rose, bg = palette.highlight_med }, + LspReferenceWrite = { fg = palette.rose, bg = palette.highlight_med }, -- TODO: Deprecate in favour of 0.6.0 groups LspDiagnosticsSignWarning = { link = 'DiagnosticSignWarn' }, @@ -230,284 +209,248 @@ local theme = { LspDiagnosticsSignInformation = { link = 'DiagnosticSignInfo' }, LspDiagnosticsDefaultInformation = { link = 'DiagnosticDefaultInfo' }, LspDiagnosticsFloatingInformation = { link = 'DiagnosticFloatingInfo' }, - LspDiagnosticsVirtualTextInformation = { - link = 'DiagnosticVirtualTextInfo', - }, + LspDiagnosticsVirtualTextInformation = { link = 'DiagnosticVirtualTextInfo' }, LspDiagnosticsUnderlineInformation = { link = 'DiagnosticUnderlineInfo' }, -- RedrawDebugNormal - RedrawDebugClear = { fg = '#ffffff', bg = p.gold }, - RedrawDebugComposed = { fg = '#ffffff', bg = p.pine }, - RedrawDebugRecompose = { fg = '#ffffff', bg = p.love }, + RedrawDebugClear = { fg = '#ffffff', bg = palette.gold }, + RedrawDebugComposed = { fg = '#ffffff', bg = palette.pine }, + RedrawDebugRecompose = { fg = '#ffffff', bg = palette.love }, - NvimInternalError = { fg = '#ffffff', bg = p.love }, + NvimInternalError = { fg = '#ffffff', bg = palette.love }, -- TSAnnotation = {}, -- TSAttribute = {}, - TSBoolean = { fg = p.rose }, + TSBoolean = { fg = palette.rose }, -- TSCharacter = {}, - TSComment = { - fg = c.comment, - style = maybe_italic, - }, + TSComment = { fg = group.comment, style = maybe_italic }, -- TSConditional = {}, - TSConstBuiltin = { fg = p.love }, + TSConstBuiltin = { fg = palette.love }, -- TSConstMacro = {}, - TSConstant = { fg = p.foam }, - TSConstructor = { fg = p.foam }, + TSConstant = { fg = palette.foam }, + TSConstructor = { fg = palette.foam }, -- TSEmphasis = {}, -- TSError = {}, -- TSException = {}, - TSField = { fg = p.foam }, + TSField = { fg = palette.foam }, -- TSFloat = {}, - TSFuncBuiltin = { fg = p.love }, + TSFuncBuiltin = { fg = palette.love }, -- TSFuncMacro = {}, - TSFunction = { fg = p.rose }, - TSInclude = { fg = p.pine }, - TSKeyword = { fg = p.pine }, + TSFunction = { fg = palette.rose }, + TSInclude = { fg = palette.pine }, + TSKeyword = { fg = palette.pine }, -- TSKeywordFunction = {}, - TSKeywordOperator = { fg = p.subtle }, - TSLabel = { fg = p.foam }, + TSKeywordOperator = { fg = palette.subtle }, + TSLabel = { fg = palette.foam }, -- TSLiteral = {}, -- TSMethod = {}, -- TSNamespace = {}, -- TSNone = {}, -- TSNumber = {}, - TSOperator = { fg = p.subtle }, - TSParameter = { - fg = p.iris, - style = maybe_italic, - }, + TSOperator = { fg = palette.subtle }, + TSParameter = { fg = palette.iris, style = maybe_italic }, -- TSParameterReference = {}, - TSProperty = { - fg = p.iris, - style = maybe_italic, - }, - TSPunctBracket = { fg = c.punctuation }, - TSPunctDelimiter = { fg = c.punctuation }, - TSPunctSpecial = { fg = c.punctuation }, + TSProperty = { fg = palette.iris, style = maybe_italic }, + TSPunctBracket = { fg = group.punctuation }, + TSPunctDelimiter = { fg = group.punctuation }, + TSPunctSpecial = { fg = group.punctuation }, -- TSRepeat = {}, -- TSStrike = {}, - TSString = { fg = p.gold }, - TSStringEscape = { fg = p.pine }, + TSString = { fg = palette.gold }, + TSStringEscape = { fg = palette.pine }, -- TSStringRegex = {}, TSStringSpecial = { link = 'TSString' }, -- TSSymbol = {}, - TSTag = { fg = p.foam }, - TSTagDelimiter = { fg = p.subtle }, - TSText = { fg = p.text }, - TSTitle = { fg = c.headings.h1, style = 'bold' }, + TSTag = { fg = palette.foam }, + TSTagDelimiter = { fg = palette.subtle }, + TSText = { fg = palette.text }, + TSTitle = { fg = group.headings.h1, style = 'bold' }, -- TSType = {}, -- TSTypeBuiltin = {}, - TSURI = { fg = p.gold }, + TSURI = { fg = palette.gold }, -- TSUnderline = {}, - TSVariable = { - fg = p.text, - style = maybe_italic, - }, - TSVariableBuiltin = { fg = p.love }, + TSVariable = { fg = palette.text, style = maybe_italic }, + TSVariableBuiltin = { fg = palette.love }, - -- barbar.nvim - -- https://github.com/romgrk/barbar.nvim - BufferTabpageFill = { fg = p.base, bg = p.base }, - BufferCurrent = { fg = p.text, bg = p.overlay }, - BufferCurrentIndex = { fg = p.text, bg = p.overlay }, - BufferCurrentMod = { fg = p.foam, bg = p.overlay }, - BufferCurrentSign = { fg = p.subtle, bg = p.overlay }, - BufferCurrentTarget = { fg = p.gold, bg = p.overlay }, - BufferInactive = { fg = p.subtle }, - BufferInactiveIndex = { fg = p.subtle }, - BufferInactiveMod = { fg = p.foam }, - BufferInactiveSign = { fg = p.muted }, - BufferInactiveTarget = { fg = p.gold }, - BufferVisible = { fg = p.subtle }, - BufferVisibleIndex = { fg = p.subtle }, - BufferVisibleMod = { fg = p.foam }, - BufferVisibleSign = { fg = p.muted }, - BufferVisibleTarget = { fg = p.gold }, + -- romgrk/barbar.nvim + BufferTabpageFill = { fg = palette.base, bg = palette.base }, + BufferCurrent = { fg = palette.text, bg = palette.overlay }, + BufferCurrentIndex = { fg = palette.text, bg = palette.overlay }, + BufferCurrentMod = { fg = palette.foam, bg = palette.overlay }, + BufferCurrentSign = { fg = palette.subtle, bg = palette.overlay }, + BufferCurrentTarget = { fg = palette.gold, bg = palette.overlay }, + BufferInactive = { fg = palette.subtle }, + BufferInactiveIndex = { fg = palette.subtle }, + BufferInactiveMod = { fg = palette.foam }, + BufferInactiveSign = { fg = palette.muted }, + BufferInactiveTarget = { fg = palette.gold }, + BufferVisible = { fg = palette.subtle }, + BufferVisibleIndex = { fg = palette.subtle }, + BufferVisibleMod = { fg = palette.foam }, + BufferVisibleSign = { fg = palette.muted }, + BufferVisibleTarget = { fg = palette.gold }, - -- gitsigns.nvim - -- https://github.com/lewis6991/gitsigns.nvim - SignAdd = { fg = p.foam }, - SignChange = { fg = p.rose }, - SignDelete = { fg = p.love }, - GitSignsAdd = { fg = p.foam }, - GitSignsChange = { fg = p.rose }, - GitSignsDelete = { fg = p.love }, + -- lewis6991/gitsigns.nvim + SignAdd = { fg = group.git_add }, + SignChange = { fg = group.git_change }, + SignDelete = { fg = group.git_delete }, + GitSignsAdd = { fg = group.git_add }, + GitSignsChange = { fg = group.git_change }, + GitSignsDelete = { fg = group.git_delete }, - -- modes.nvim - -- https://github.com/mvllow/modes.nvim - ModesCopy = { bg = p.gold }, - ModesDelete = { bg = p.love }, - ModesInsert = { bg = p.foam }, - ModesVisual = { bg = p.iris }, + -- mvllow/modes.nvim + ModesCopy = { bg = palette.gold }, + ModesDelete = { bg = palette.love }, + ModesInsert = { bg = palette.foam }, + ModesVisual = { bg = palette.iris }, - -- nvim-tree.lua - -- https://github.com/kyazdani42/nvim-tree.lua - NvimTreeNormal = { fg = p.text }, - NvimTreeFileDeleted = { fg = p.love }, - NvimTreeFileDirty = { fg = p.rose }, - NvimTreeFileMerge = { fg = p.iris }, - NvimTreeFileNew = { fg = p.foam }, - NvimTreeFileRenamed = { fg = p.pine }, - NvimTreeFileStaged = { fg = p.iris }, - NvimTreeEmptyFolderName = { fg = p.muted }, - NvimTreeFolderIcon = { fg = p.subtle }, - NvimTreeFolderName = { fg = p.foam }, - NvimTreeImageFile = { fg = p.text }, - NvimTreeOpenedFile = { fg = p.text, bg = p.highlight_med }, - NvimTreeOpenedFolderName = { fg = p.foam }, - NvimTreeRootFolder = { fg = p.iris }, + -- kyazdani42/nvim-tree.lua + NvimTreeNormal = { fg = palette.text }, + NvimTreeFileDeleted = { fg = palette.love }, + NvimTreeFileDirty = { fg = palette.rose }, + NvimTreeFileMerge = { fg = palette.iris }, + NvimTreeFileNew = { fg = palette.foam }, + NvimTreeFileRenamed = { fg = palette.pine }, + NvimTreeFileStaged = { fg = palette.iris }, + NvimTreeEmptyFolderName = { fg = palette.muted }, + NvimTreeFolderIcon = { fg = palette.subtle }, + NvimTreeFolderName = { fg = palette.foam }, + NvimTreeImageFile = { fg = palette.text }, + NvimTreeOpenedFile = { fg = palette.text, bg = palette.highlight_med }, + NvimTreeOpenedFolderName = { fg = palette.foam }, + NvimTreeRootFolder = { fg = palette.iris }, NvimTreeSpecialFile = { link = 'NvimTreeNormal' }, - NvimTreeGitDeleted = { fg = p.love }, - NvimTreeGitDirty = { fg = p.rose }, - NvimTreeGitIgnored = { fg = p.subtle }, - NvimTreeGitMerge = { fg = p.iris }, - NvimTreeGitNew = { fg = p.foam }, - NvimTreeGitRenamed = { fg = p.pine }, - NvimTreeGitStaged = { fg = p.iris }, - NvimTreeWindowPicker = { fg = p.base, bg = p.iris }, + NvimTreeGitDeleted = { fg = group.git_delete }, + NvimTreeGitDirty = { fg = group.git_dirty }, + NvimTreeGitIgnored = { fg = group.git_ignore }, + NvimTreeGitMerge = { fg = group.git_merge }, + NvimTreeGitNew = { fg = group.git_add }, + NvimTreeGitRenamed = { fg = group.git_rename }, + NvimTreeGitStaged = { fg = group.git_stage }, + NvimTreeWindowPicker = { fg = palette.base, bg = palette.iris }, - -- which-key.nvim - -- https://github.com/folke/which-key.nvim - WhichKey = { fg = p.iris }, - WhichKeyGroup = { fg = p.foam }, - WhichKeySeparator = { fg = p.subtle }, - WhichKeyDesc = { fg = p.gold }, - WhichKeyFloat = { bg = p.surface }, - WhichKeyValue = { fg = p.rose }, + -- folke/which-key.nvim + WhichKey = { fg = palette.iris }, + WhichKeyGroup = { fg = palette.foam }, + WhichKeySeparator = { fg = palette.subtle }, + WhichKeyDesc = { fg = palette.gold }, + WhichKeyFloat = { bg = palette.surface }, + WhichKeyValue = { fg = palette.rose }, - -- indent-blankline.nvim - -- https://github.com/lukas-reineke/indent-blankline.nvim - IndentBlanklineChar = { fg = p.subtle }, + -- luka-reineke/indent-blankline.nvim + IndentBlanklineChar = { fg = palette.muted }, - -- nvim-cmp - -- https://github.com/hrsh7th/nvim-cmp - CmpItemKind = { fg = p.iris }, - CmpItemAbbr = { fg = p.subtle }, - CmpItemAbbrMatch = { fg = p.text, style = 'bold' }, - CmpItemAbbrMatchFuzzy = { fg = p.text, style = 'bold' }, - CmpItemAbbrDeprecated = { fg = p.subtle, style = 'strikethrough' }, - CmpItemKindVariable = { fg = p.foam }, - CmpItemKindClass = { fg = p.gold }, - CmpItemKindInterface = { fg = p.gold }, - CmpItemKindFunction = { fg = p.iris }, - CmpItemKindMethod = { fg = p.iris }, - CmpItemKindSnippet = { fg = p.iris }, + -- hrsh7th/nvim-cmp + CmpItemKind = { fg = palette.iris }, + CmpItemAbbr = { fg = palette.subtle }, + CmpItemAbbrMatch = { fg = palette.text, style = 'bold' }, + CmpItemAbbrMatchFuzzy = { fg = palette.text, style = 'bold' }, + CmpItemAbbrDeprecated = { fg = palette.subtle, style = 'strikethrough' }, + CmpItemKindVariable = { fg = palette.foam }, + CmpItemKindClass = { fg = palette.gold }, + CmpItemKindInterface = { fg = palette.gold }, + CmpItemKindFunction = { fg = palette.iris }, + CmpItemKindMethod = { fg = palette.iris }, + CmpItemKindSnippet = { fg = palette.iris }, - -- neogit - -- https://github.com/TimUntersberger/neogit - NeogitDiffAddHighlight = { fg = p.foam, bg = p.highlight_med }, - NeogitDiffDeleteHighlight = { - fg = p.love, - bg = p.highlight_med, - }, - NeogitDiffContextHighlight = { bg = p.highlight_low }, - NeogitHunkHeader = { bg = p.highlight_low }, - NeogitHunkHeaderHighlight = { bg = p.highlight_low }, + -- TimUntersberger/neogit + NeogitDiffAddHighlight = { fg = palette.foam, bg = palette.highlight_med }, + NeogitDiffDeleteHighlight = { fg = palette.love, bg = palette.highlight_med }, + NeogitDiffContextHighlight = { bg = palette.highlight_low }, + NeogitHunkHeader = { bg = palette.highlight_low }, + NeogitHunkHeaderHighlight = { bg = palette.highlight_low }, - -- VimWiki - -- https://github.com/vimwiki/vimwiki - VimwikiHR = { fg = p.subtle }, - VimwikiHeader1 = { fg = c.headings.h1, style = 'bold' }, - VimwikiHeader2 = { fg = c.headings.h2, style = 'bold' }, - VimwikiHeader3 = { fg = c.headings.h3, style = 'bold' }, - VimwikiHeader4 = { fg = c.headings.h4, style = 'bold' }, - VimwikiHeader5 = { fg = c.headings.h5, style = 'bold' }, - VimwikiHeader6 = { fg = c.headings.h6, style = 'bold' }, - VimwikiHeaderChar = { fg = p.pine }, - VimwikiLink = { fg = p.rose, style = 'underline' }, - VimwikiList = { fg = p.iris }, - VimwikiNoExistsLink = { fg = p.love }, + -- vimwiki/vimwiki + VimwikiHR = { fg = palette.subtle }, + VimwikiHeader1 = { fg = group.headings.h1, style = 'bold' }, + VimwikiHeader2 = { fg = group.headings.h2, style = 'bold' }, + VimwikiHeader3 = { fg = group.headings.h3, style = 'bold' }, + VimwikiHeader4 = { fg = group.headings.h4, style = 'bold' }, + VimwikiHeader5 = { fg = group.headings.h5, style = 'bold' }, + VimwikiHeader6 = { fg = group.headings.h6, style = 'bold' }, + VimwikiHeaderChar = { fg = palette.pine }, + VimwikiLink = { fg = group.link, style = 'underline' }, + VimwikiList = { fg = palette.iris }, + VimwikiNoExistsLink = { fg = palette.love }, - -- Neorg - -- https://github.com/nvim-neorg/neorg - NeorgHeading1Prefix = { fg = c.headings.h1, style = 'bold' }, - NeorgHeading2Prefix = { fg = c.headings.h2, style = 'bold' }, - NeorgHeading3Prefix = { fg = c.headings.h3, style = 'bold' }, - NeorgHeading4Prefix = { fg = c.headings.h4, style = 'bold' }, - NeorgHeading5Prefix = { fg = c.headings.h5, style = 'bold' }, - NeorgHeading6Prefix = { fg = c.headings.h6, style = 'bold' }, + -- nvim-neorg/neorg + NeorgHeading1Prefix = { fg = group.headings.h1, style = 'bold' }, + NeorgHeading1Title = { fg = group.headings.h1, style = 'bold' }, + NeorgHeading2Prefix = { fg = group.headings.h2, style = 'bold' }, + NeorgHeading2Title = { fg = group.headings.h2, style = 'bold' }, + NeorgHeading3Prefix = { fg = group.headings.h3, style = 'bold' }, + NeorgHeading3Title = { fg = group.headings.h3, style = 'bold' }, + NeorgHeading4Prefix = { fg = group.headings.h4, style = 'bold' }, + NeorgHeading4Title = { fg = group.headings.h4, style = 'bold' }, + NeorgHeading5Prefix = { fg = group.headings.h5, style = 'bold' }, + NeorgHeading5Title = { fg = group.headings.h5, style = 'bold' }, + NeorgHeading6Prefix = { fg = group.headings.h6, style = 'bold' }, + NeorgHeading6Title = { fg = group.headings.h6, style = 'bold' }, + NeorgMarkerTitle = { fg = palette.text, style = 'bold' }, - NeorgHeading1Title = { fg = c.headings.h1, style = 'bold' }, - NeorgHeading2Title = { fg = c.headings.h2, style = 'bold' }, - NeorgHeading3Title = { fg = c.headings.h3, style = 'bold' }, - NeorgHeading4Title = { fg = c.headings.h4, style = 'bold' }, - NeorgHeading5Title = { fg = c.headings.h5, style = 'bold' }, - NeorgHeading6Title = { fg = c.headings.h6, style = 'bold' }, - - NeorgMarkerTitle = { fg = p.text, style = 'bold' }, - -- LspSaga - -- https://github.com/tami5/lspsaga.nvim (fork of https://github.com/glepnir/lspsaga.nvim) - LspSagaCodeActionTitle = { - fg = p.gold, - style = 'bold', - }, - LspSagaCodeActionBorder = { fg = c.border }, + -- tami5/lspsaga.nvim (fork of glepnir/lspsaga.nvim) + DefinitionCount = { fg = palette.rose }, + DefinitionIcon = { fg = palette.rose }, + DefintionPreviewTitle = { fg = palette.rose, style = 'bold' }, + LspFloatWinBorder = { fg = group.border }, + LspFloatWinNormal = { bg = palette.base }, + LspSagaAutoPreview = { fg = palette.subtle }, + LspSagaCodeActionBorder = { fg = group.border }, + LspSagaCodeActionContent = { fg = palette.foam }, + LspSagaCodeActionTitle = { fg = palette.gold, style = 'bold' }, LspSagaCodeActionTruncateLine = { link = 'LspSagaCodeActionBorder' }, - LspSagaCodeActionContent = { fg = p.foam }, - LspSagaDiagnosticBorder = { fg = c.border }, - LspSagaDiagnosticHeader = { fg = p.gold, style = 'bold' }, + LspSagaDefPreviewBorder = { fg = group.border }, + LspSagaDiagnosticBorder = { fg = group.border }, + LspSagaDiagnosticHeader = { fg = palette.gold, style = 'bold' }, LspSagaDiagnosticTruncateLine = { link = 'LspSagaDiagnosticBorder' }, - LspSagaFinderSelection = { fg = p.gold }, - LspSagaLspFinderBorder = { fg = c.border }, - LspSagaAutoPreview = { fg = p.subtle }, - LspSagaDefPreviewBorder = { fg = c.border }, - DefinitionIcon = { fg = p.rose }, - DefinitionCount = { fg = p.rose }, - ReferencesCount = { fg = p.rose }, - ReferencesIcon = { fg = p.rose }, - DefintionPreviewTitle = { fg = p.rose, style = 'bold' }, - LspSagaRenamePromptPrefix = { fg = p.love }, - LspSagaRenameBorder = { fg = p.pine }, - LspFloatWinNormal = { bg = p.base }, - LspFloatWinBorder = { fg = c.border }, LspSagaDocTruncateLine = { link = 'LspSagaHoverBorder' }, - LspSagaHoverBorder = { fg = c.border }, - LspSagaSignatureHelpBorder = { fg = p.pine }, + LspSagaFinderSelection = { fg = palette.gold }, + LspSagaHoverBorder = { fg = group.border }, + LspSagaLspFinderBorder = { fg = group.border }, + LspSagaRenameBorder = { fg = palette.pine }, + LspSagaRenamePromptPrefix = { fg = palette.love }, LspSagaShTruncateLine = { link = 'LspSagaSignatureHelpBorder' }, - TargetWord = { fg = p.iris }, + LspSagaSignatureHelpBorder = { fg = palette.pine }, + ReferencesCount = { fg = palette.rose }, + ReferencesIcon = { fg = palette.rose }, + SagaShadow = { bg = palette.overlay }, + TargetWord = { fg = palette.iris }, - SagaShadow = { bg = p.overlay }, + -- ray-x/lsp_signature.nvim + LspSignatureActiveParameter = { bg = palette.overlay }, - -- Lsp_Signature - -- https://github.com/ray-x/lsp_signature.nvim - LspSignatureActiveParameter = { bg = p.overlay }, - - -- pounce - -- https://github.com/rlane/pounce.nvim - PounceMatch = { link = 'Search' }, + -- rlane/pounce.nvim + PounceAccept = { fg = palette.love, bg = palette.highlight_high }, + PounceAcceptBest = { fg = palette.base, bg = palette.gold }, PounceGap = { link = 'Search' }, - PounceAccept = { fg = p.love, bg = p.highlight_high }, - PounceAcceptBest = { fg = p.base, bg = p.gold }, + PounceMatch = { link = 'Search' }, - -- telescope.nvim - -- https://github.com/nvim-telescope/telescope.nvim - TelescopeNormal = { fg = p.subtle }, - TelescopePromptNormal = { fg = p.text }, - TelescopeBorder = { fg = c.border }, - TelescopeMatching = { fg = p.rose }, - TelescopePromptPrefix = { fg = p.subtle }, - TelescopeSelection = { fg = p.text, bg = p.highlight_low }, - TelescopeSelectionCaret = { fg = p.rose, bg = p.highlight_low }, - TelescopeTitle = { fg = p.subtle }, + -- nvim-telescope/telescope.nvim + TelescopeBorder = { fg = group.border }, + TelescopeMatching = { fg = palette.rose }, + TelescopeNormal = { fg = palette.subtle }, + TelescopePromptNormal = { fg = palette.text }, + TelescopePromptPrefix = { fg = palette.subtle }, + TelescopeSelection = { fg = palette.text, bg = palette.highlight_low }, + TelescopeSelectionCaret = { fg = palette.rose, bg = palette.highlight_low }, + TelescopeTitle = { fg = palette.subtle }, } -vim.g.terminal_color_0 = p.overlay -- black -vim.g.terminal_color_8 = p.subtle -- bright black -vim.g.terminal_color_1 = p.love -- red -vim.g.terminal_color_9 = p.love -- bright red -vim.g.terminal_color_2 = p.pine -- green -vim.g.terminal_color_10 = p.pine -- bright green -vim.g.terminal_color_3 = p.gold -- yellow -vim.g.terminal_color_11 = p.gold -- bright yellow -vim.g.terminal_color_4 = p.foam -- blue -vim.g.terminal_color_12 = p.foam -- bright blue -vim.g.terminal_color_5 = p.iris -- magenta -vim.g.terminal_color_13 = p.iris -- bright magenta -vim.g.terminal_color_6 = p.rose -- cyan -vim.g.terminal_color_14 = p.rose -- bright cyan -vim.g.terminal_color_7 = p.text -- white -vim.g.terminal_color_15 = p.text -- bright white +vim.g.terminal_color_0 = palette.overlay -- black +vim.g.terminal_color_8 = palette.subtle -- bright black +vim.g.terminal_color_1 = palette.love -- red +vim.g.terminal_color_9 = palette.love -- bright red +vim.g.terminal_color_2 = palette.pine -- green +vim.g.terminal_color_10 = palette.pine -- bright green +vim.g.terminal_color_3 = palette.gold -- yellow +vim.g.terminal_color_11 = palette.gold -- bright yellow +vim.g.terminal_color_4 = palette.foam -- blue +vim.g.terminal_color_12 = palette.foam -- bright blue +vim.g.terminal_color_5 = palette.iris -- magenta +vim.g.terminal_color_13 = palette.iris -- bright magenta +vim.g.terminal_color_6 = palette.rose -- cyan +vim.g.terminal_color_14 = palette.rose -- bright cyan +vim.g.terminal_color_7 = palette.text -- white +vim.g.terminal_color_15 = palette.text -- bright white return theme diff --git a/readme.md b/readme.md index 2a02672..064f277 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ use({ 'rose-pine/neovim', as = 'rose-pine', - tag = 'v0.1.0', -- Optional tag release + -- tag = '...', config = function() vim.cmd('colorscheme rose-pine') end @@ -43,7 +43,6 @@ use({ - [Telescope](https://github.com/nvim-telescope/telescope.nvim) - [Lualine](https://github.com/hoob3rt/lualine.nvim) - ```lua require('lualine').setup({ options = { theme = 'rose-pine' } @@ -75,35 +74,46 @@ local colors = require("galaxyline.themes.colors")["rose-pine"] > Options should be set **before** colorscheme ```lua --- Set theme variant --- Matches terminal theme if unset +-- set theme variant, matching terminal theme if unset -- @usage 'main' | 'moon' | 'dawn' vim.g.rose_pine_variant = '' vim.g.rose_pine_bold_vertical_split_line = false -vim.g.rose_pine_inactive_background = false vim.g.rose_pine_disable_background = false vim.g.rose_pine_disable_float_background = false vim.g.rose_pine_disable_italics = false +vim.g.rose_pine_inactive_background = false -local p = require('rose-pine.palette') +local palette = require('rose-pine.palette') vim.g.rose_pine_colors = { - punctuation = p.subtle, - comment = p.subtle, - border = p.highlight_med, - hint = p.iris, - info = p.foam, - warn = p.gold, - error = p.love, + border = palette.highlight_med, + comment = palette.muted, + link = palette.iris, + punctuation = palette.subtle, - -- Or set all headings to one colour: `headings = p.text` + error = palette.love, + hint = palette.iris, + info = palette.foam, + warn = palette.gold, + + git_add = palette.foam, + git_change = palette.rose, + git_delete = palette.love, + git_dirty = palette.rose, + git_ignore = palette.muted, + git_merge = palette.iris, + git_rename = palette.pine, + git_stage = palette.iris, + git_text = palette.rose, + + -- or set all headings to one colour: `headings = palette.text` headings = { - h1 = p.iris, - h2 = p.foam, - h3 = p.rose, - h4 = p.gold, - h5 = p.pine, - h6 = p.foam, + h1 = palette.iris, + h2 = palette.foam, + h3 = palette.rose, + h4 = palette.gold, + h5 = palette.pine, + h6 = palette.foam, }, } @@ -111,31 +121,19 @@ vim.g.rose_pine_colors = { vim.cmd('colorscheme rose-pine') ``` -## Functions +## Suggested keymaps ```lua --- Toggle between all variants -require('rose-pine').toggle() +-- toggle between all variants +vim.keymap.set('n', 'tt', require('rose-pine').toggle) --- Toggle between some variants -require('rose-pine').toggle({'main', 'dawn'}) +-- or toggle between some variants +vim.keymap.set('n', 'tt', function() return require('rose-pine').toggle({'moon', 'dawn'}) end) --- Set specific variant -require('rose-pine').set('moon') -``` - -## Keymaps - -> These are only suggestions; no keymaps are set by the theme - -```lua --- Toggle variants -vim.api.nvim_set_keymap('n', '', [[lua require('rose-pine').toggle()]], { noremap = true, silent = true }) - --- Set variant -vim.api.nvim_set_keymap('n', '', [[lua require('rose-pine').set('main')]], { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '', [[lua require('rose-pine').set('moon')]], { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '', [[lua require('rose-pine').set('dawn')]], { noremap = true, silent = true }) +-- set variant +vim.keymap.set('n', 't1', function() return require('rose-pine').set('main') end) +vim.keymap.set('n', 't2', function() return require('rose-pine').set('moon') end) +vim.keymap.set('n', 't3', function() return require('rose-pine').set('dawn') end) ``` ## Contributing