From 826458a62cdac2e45abed558df27404fab625002 Mon Sep 17 00:00:00 2001 From: not Date: Mon, 6 Mar 2023 14:40:10 -0600 Subject: [PATCH] feat: add `background_nc` and `panel_nc` groups (#130) (#132) --- lua/rose-pine/config.lua | 4 ++++ lua/rose-pine/palette.lua | 6 +++--- lua/rose-pine/theme.lua | 42 +++++++++++++++++++-------------------- readme.md | 2 ++ 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/lua/rose-pine/config.lua b/lua/rose-pine/config.lua index c5a935e..156bb7e 100644 --- a/lua/rose-pine/config.lua +++ b/lua/rose-pine/config.lua @@ -2,7 +2,9 @@ local M = {} ---@class Groups ---@field background string +---@field background_nc string ---@field panel string +---@field panel_nc string ---@field border string ---@field comment string ---@field link string @@ -52,7 +54,9 @@ local defaults = { groups = { background = 'base', + background_nc = '_experimental_nc', panel = 'surface', + panel_nc = 'base', border = 'highlight_med', comment = 'muted', link = 'iris', diff --git a/lua/rose-pine/palette.lua b/lua/rose-pine/palette.lua index db776f5..5ede492 100644 --- a/lua/rose-pine/palette.lua +++ b/lua/rose-pine/palette.lua @@ -2,7 +2,7 @@ local options = require('rose-pine.config').options local variants = { main = { - nc = '#16141f', + _experimental_nc = '#16141f', base = '#191724', surface = '#1f1d2e', overlay = '#26233a', @@ -21,7 +21,7 @@ local variants = { none = 'NONE', }, moon = { - nc = '#1f1d30', + _experimental_nc = '#1f1d30', base = '#232136', surface = '#2a273f', overlay = '#393552', @@ -40,7 +40,7 @@ local variants = { none = 'NONE', }, dawn = { - nc = '#f8f0e7', + _experimental_nc = '#f8f0e7', base = '#faf4ed', surface = '#fffaf3', overlay = '#f2e9e1', diff --git a/lua/rose-pine/theme.lua b/lua/rose-pine/theme.lua index 5acb428..8a7a72f 100644 --- a/lua/rose-pine/theme.lua +++ b/lua/rose-pine/theme.lua @@ -7,13 +7,15 @@ function M._load(options) local groups = options.groups or {} local maybe = { - base = (options.disable_background and p.none) or p.base, - surface = (options.disable_float_background and p.none) or p.surface, + base = (options.disable_background and p.none) or groups.background, + surface = (options.disable_float_background and p.none) or groups.panel, italic = not options.disable_italics, } maybe.bold_vert_split = (options.bold_vert_split and groups.border) or p.none - maybe.dim_nc_background = (options.dim_nc_background and p.nc) + maybe.dim_nc_background = ( + options.dim_nc_background and groups.background_nc + ) or maybe.base h('ColorColumn', { bg = p.overlay }) h('Conceal', { bg = p.none }) @@ -50,7 +52,7 @@ function M._load(options) h('NormalFloat', { fg = p.text, bg = maybe.surface }) h('NormalNC', { fg = p.text, bg = maybe.dim_nc_background }) h('NvimInternalError', { fg = '#ffffff', bg = p.love }) - h('Pmenu', { fg = p.subtle, bg = p.maybe_surface }) + h('Pmenu', { fg = p.subtle, bg = maybe.surface }) h('PmenuSbar', { bg = p.highlight_low }) h('PmenuSel', { fg = p.text, bg = p.overlay }) h('PmenuThumb', { bg = p.highlight_med }) @@ -70,12 +72,12 @@ function M._load(options) fg = p.text, bg = (options.dim_nc_background and p.none) or maybe.base, }) - h('StatusLine', { fg = p.subtle, bg = p.surface }) - h('StatusLineNC', { fg = p.muted, bg = maybe.base }) + h('StatusLine', { fg = p.subtle, bg = groups.panel }) + h('StatusLineNC', { fg = p.muted, bg = groups.panel_nc }) h('StatusLineTerm', { link = 'StatusLine' }) h('StatusLineTermNC', { link = 'StatusLineNC' }) - h('TabLine', { fg = p.subtle, bg = p.surface }) - h('TabLineFill', { bg = p.surface }) + h('TabLine', { fg = p.subtle, bg = groups.panel }) + h('TabLineFill', { bg = groups.panel }) h('TabLineSel', { fg = p.text, bg = p.overlay }) h('Title', { fg = p.text }) h('VertSplit', { fg = groups.border, bg = maybe.bold_vert_split }) @@ -183,10 +185,10 @@ function M._load(options) h('DiagnosticSignHint', { fg = groups.hint }) h('DiagnosticSignInfo', { fg = groups.info }) h('DiagnosticSignWarn', { fg = groups.warn }) - h('DiagnosticStatusLineError', { fg = groups.error, bg = p.surface }) - h('DiagnosticStatusLineHint', { fg = groups.hint, bg = p.surface }) - h('DiagnosticStatusLineInfo', { fg = groups.info, bg = p.surface }) - h('DiagnosticStatusLineWarn', { fg = groups.warn, bg = p.surface }) + h('DiagnosticStatusLineError', { fg = groups.error, bg = groups.panel }) + h('DiagnosticStatusLineHint', { fg = groups.hint, bg = groups.panel }) + h('DiagnosticStatusLineInfo', { fg = groups.info, bg = groups.panel }) + h('DiagnosticStatusLineWarn', { fg = groups.warn, bg = groups.panel }) h('DiagnosticUnderlineError', { sp = groups.error, undercurl = true }) h('DiagnosticUnderlineHint', { sp = groups.hint, undercurl = true }) h('DiagnosticUnderlineInfo', { sp = groups.info, undercurl = true }) @@ -424,22 +426,20 @@ function M._load(options) h('PounceGap', { link = 'Search' }) h('PounceMatch', { link = 'Search' }) + local float_background = options.dim_nc_background + and (options.disable_float_background and groups.panel_nc or groups.panel) + or maybe.surface + -- ggandor/leap.nvim h('LeapMatch', { link = 'MatchParen' }) h('LeapLabelPrimary', { link = 'IncSearch' }) h('LeapLabelSecondary', { fg = p.base, bg = p.pine }) -- nvim-telescope/telescope.nvim - h('TelescopeBorder', { fg = groups.border, bg = maybe.surface }) + h('TelescopeBorder', { fg = groups.border, bg = float_background }) h('TelescopeMatching', { fg = p.rose }) - h('TelescopeNormal', { fg = p.subtle, bg = maybe.surface }) - h('TelescopePromptNormal', { - fg = p.text, - bg = ( - options.dim_nc_background - and (options.disable_float_background and p.nc or p.surface) - ) or maybe.surface, - }) + h('TelescopeNormal', { fg = p.subtle, bg = float_background }) + h('TelescopePromptNormal', { fg = p.text, bg = float_background }) h('TelescopePromptPrefix', { fg = p.subtle }) h('TelescopeSelection', { fg = p.text, bg = p.overlay }) h('TelescopeSelectionCaret', { fg = p.rose, bg = p.overlay }) diff --git a/readme.md b/readme.md index c197a31..370828d 100644 --- a/readme.md +++ b/readme.md @@ -78,7 +78,9 @@ require('rose-pine').setup({ --- @usage string hex value or named color from rosepinetheme.com/palette groups = { background = 'base', + background_nc = '_experimental_nc', panel = 'surface', + panel_nc = 'base', border = 'highlight_med', comment = 'muted', link = 'iris',