Compare commits

..

No commits in common. "main" and "v3.0.2" have entirely different histories.

5 changed files with 8 additions and 90 deletions

View file

@ -1,7 +1,7 @@
local p = require("rose-pine.palette")
local config = require("rose-pine.config")
local bg_base = p.surface
local bg_base = p.base
if config.options.styles.transparency then
bg_base = "NONE"
end

View file

@ -121,7 +121,7 @@ local function set_highlights()
PmenuSel = { fg = palette.text, bg = palette.overlay },
PmenuThumb = { bg = palette.muted },
Question = { fg = palette.gold },
QuickFixLine = { fg = palette.foam },
-- QuickFixLink = {},
-- RedrawDebugNormal = {},
RedrawDebugClear = { fg = palette.base, bg = palette.gold },
RedrawDebugComposed = { fg = palette.base, bg = palette.pine },
@ -462,7 +462,6 @@ local function set_highlights()
-- mvllow/modes.nvim
ModesCopy = { bg = palette.gold },
ModesDelete = { bg = palette.love },
ModesFormat = { bg = palette.rose },
ModesInsert = { bg = palette.foam },
ModesReplace = { bg = palette.pine },
ModesVisual = { bg = palette.iris },
@ -723,7 +722,6 @@ local function set_highlights()
DapUIThread = { fg = palette.gold },
DapUIValue = { fg = palette.text },
DapUIVariable = { fg = palette.text },
DapUIType = { fg = palette.iris },
DapUIWatchesEmpty = { fg = palette.love },
DapUIWatchesError = { link = "DapUIWatchesEmpty" },
DapUIWatchesValue = { link = "DapUIThread" },
@ -962,8 +960,6 @@ local function set_highlights()
GrugFarInputPlaceholder = { link = "Comment" },
GrugFarResultsActionMessage = { fg = palette.foam },
GrugFarResultsChangeIndicator = { fg = groups.git_change },
GrugFarResultsRemoveIndicator = { fg = groups.git_delete },
GrugFarResultsAddIndicator = { fg = groups.git_add },
GrugFarResultsHeader = { fg = palette.pine },
GrugFarResultsLineNo = { fg = palette.iris },
GrugFarResultsLineColumn = { link = "GrugFarResultsLineNo" },
@ -978,12 +974,9 @@ local function set_highlights()
AvanteReversedSubtitle = { fg = palette.foam },
AvanteThirdTitle = { fg = palette.highlight_med, bg = palette.iris },
AvanteReversedThirdTitle = { fg = palette.iris },
AvantePromptInput = { fg = palette.text, bg = groups.panel },
AvantePromptInputBorder = { fg = groups.border },
-- Saghen/blink.cmp
BlinkCmpDoc = { bg = palette.highlight_low },
BlinkCmpDocSeparator = { bg = palette.highlight_low },
BlinkCmpDoc = { fg = palette.text },
BlinkCmpDocBorder = { fg = palette.highlight_high },
BlinkCmpGhostText = { fg = palette.muted },
@ -1029,44 +1022,6 @@ local function set_highlights()
SnacksIndentScope = { fg = palette.foam },
SnacksPickerMatch = { fg = palette.rose, bold = styles.bold },
-- justinmk/vim-sneak
Sneak = { fg = palette.base, bg = palette.love },
SneakCurrent = { link = "StatusLineTerm" },
SneakScope = { link = "IncSearch" },
-- sindrets/diffview.nvim
DiffviewPrimary = { fg = palette.pine },
DiffviewSecondary = { fg = palette.foam },
DiffviewNormal = { fg = palette.text, bg = palette.surface },
DiffviewWinSeparator = { fg = palette.text, bg = palette.surface },
DiffviewFilePanelTitle = { fg = palette.foam, bold = styles.bold },
DiffviewFilePanelCounter = { fg = palette.rose },
DiffviewFilePanelRootPath = { fg = palette.foam, bold = styles.bold },
DiffviewFilePanelFileName = { fg = palette.text },
DiffviewFilePanelSelected = { fg = palette.gold },
DiffviewFilePanelPath = { link = "Comment" },
DiffviewFilePanelInsertions = { fg = groups.git_add },
DiffviewFilePanelDeletions = { fg = groups.git_delete },
DiffviewFilePanelConflicts = { fg = groups.git_merge },
DiffviewFolderName = { fg = palette.foam, bold = styles.bold },
DiffviewFolderSign = { fg = palette.subtle },
DiffviewHash = { fg = palette.rose },
DiffviewReference = { fg = palette.foam, bold = styles.bold },
DiffviewReflogSelector = { fg = palette.rose },
DiffviewStatusAdded = { fg = groups.git_add },
DiffviewStatusUntracked = { fg = groups.untracked },
DiffviewStatusModified = { fg = groups.git_change },
DiffviewStatusRenamed = { fg = groups.git_rename },
DiffviewStatusCopied = { fg = groups.untracked },
DiffviewStatusTypeChange = { fg = groups.git_change },
DiffviewStatusUnmerged = { fg = groups.git_change },
DiffviewStatusUnknown = { fg = groups.git_delete },
DiffviewStatusDeleted = { fg = groups.git_delete },
DiffviewStatusBroken = { fg = groups.git_delete },
DiffviewStatusIgnored = { fg = groups.git_ignore },
}
local transparency_highlights = {
DiagnosticVirtualTextError = { fg = groups.error },
@ -1167,18 +1122,9 @@ local function set_highlights()
if config.options.before_highlight ~= nil then
config.options.before_highlight(group, highlight, palette)
end
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)
end
highlight.blend = nil
highlight.blend_on = nil
if highlight._nvim_blend ~= nil then
highlight.blend = highlight._nvim_blend
end
vim.api.nvim_set_hl(0, group, highlight)
end
@ -1225,12 +1171,6 @@ function M.colorscheme(variant)
end
vim.g.colors_name = "rose-pine"
if variant == "dawn" then
vim.o.background = "light"
elseif variant == "main" or variant == "moon" then
vim.o.background = "dark"
end
set_highlights()
end

View file

@ -47,7 +47,7 @@ local variants = {
overlay = "#f2e9e1",
muted = "#9893a5",
subtle = "#797593",
text = "#464261",
text = "#575279",
love = "#b4637a",
gold = "#ea9d34",
rose = "#d7827e",

View file

@ -14,17 +14,10 @@ local function color_to_rgb(color)
return { byte(new_color, 16), byte(new_color, 8), byte(new_color, 0) }
end
local color_cache = {}
---@param color string Palette key or hex value
function utilities.parse_color(color)
if color_cache[color] then
return color_cache[color]
end
if color == nil then
print("Invalid color: " .. color)
return nil
return print("Invalid color: " .. color)
end
color = color:lower()
@ -33,21 +26,13 @@ function utilities.parse_color(color)
color = require("rose-pine.palette")[color] or vim.api.nvim_get_color_by_name(color)
end
color_cache[color] = color
return color
end
local blend_cache = {}
---@param fg string Foreground color
---@param bg string Background color
---@param alpha number Between 0 (background) and 1 (foreground)
function utilities.blend(fg, bg, alpha)
local cache_key = fg .. bg .. alpha
if blend_cache[cache_key] then
return blend_cache[cache_key]
end
local fg_rgb = color_to_rgb(fg)
local bg_rgb = color_to_rgb(bg)
@ -56,10 +41,7 @@ function utilities.blend(fg, bg, alpha)
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end
local result = string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2), blend_channel(3))
blend_cache[cache_key] = result
return result
return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2), blend_channel(3))
end
return utilities

View file

@ -27,8 +27,8 @@ Install `rose-pine/neovim` using your favourite package manager:
```lua
-- lua/plugins/rose-pine.lua
return {
"rose-pine/neovim",
return {
"rose-pine/neovim",
name = "rose-pine",
config = function()
vim.cmd("colorscheme rose-pine")
@ -123,13 +123,9 @@ require("rose-pine").setup({
-- },
},
-- NOTE: Highlight groups are extended (merged) by default. Disable this
-- per group via `inherit = false`
highlight_groups = {
-- Comment = { fg = "foam" },
-- StatusLine = { fg = "love", bg = "love", blend = 15 },
-- VertSplit = { fg = "muted", bg = "muted" },
-- Visual = { fg = "base", bg = "text", inherit = false },
},
before_highlight = function(group, highlight, palette)