Compare commits

..

No commits in common. "main" and "v2.0.0" have entirely different histories.

12 changed files with 309 additions and 974 deletions

View file

@ -1,10 +1,4 @@
local p = require("rose-pine.palette") local p = require("rose-pine.palette")
local config = require("rose-pine.config")
local bg_base = p.base
if config.options.styles.transparency then
bg_base = "NONE"
end
return { return {
normal = { normal = {
@ -25,8 +19,8 @@ return {
a = { bg = p.surface, fg = p.love, gui = "bold" }, a = { bg = p.surface, fg = p.love, gui = "bold" },
}, },
inactive = { inactive = {
a = { bg = bg_base, fg = p.subtle, gui = "bold" }, a = { bg = p.base, fg = p.subtle, gui = "bold" },
b = { bg = bg_base, fg = p.subtle }, b = { bg = p.base, fg = p.subtle },
c = { bg = bg_base, fg = p.subtle, gui = "italic" }, c = { bg = p.base, fg = p.subtle, gui = "italic" },
}, },
} }

View file

@ -1,40 +1,34 @@
local p = require("rose-pine.palette") local p = require("rose-pine.palette")
local config = require("rose-pine.config")
local bg_base = p.surface
if config.options.styles.transparency then
bg_base = "NONE"
end
return { return {
normal = { normal = {
a = { bg = p.rose, fg = p.base, gui = "bold" }, a = { bg = p.rose, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.rose }, b = { bg = p.overlay, fg = p.rose },
c = { bg = bg_base, fg = p.text }, c = { bg = p.base, fg = p.text },
}, },
insert = { insert = {
a = { bg = p.foam, fg = p.base, gui = "bold" }, a = { bg = p.foam, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.foam }, b = { bg = p.overlay, fg = p.foam },
c = { bg = bg_base, fg = p.text }, c = { bg = p.base, fg = p.text },
}, },
visual = { visual = {
a = { bg = p.iris, fg = p.base, gui = "bold" }, a = { bg = p.iris, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.iris }, b = { bg = p.overlay, fg = p.iris },
c = { bg = bg_base, fg = p.text }, c = { bg = p.base, fg = p.text },
}, },
replace = { replace = {
a = { bg = p.pine, fg = p.base, gui = "bold" }, a = { bg = p.pine, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.pine }, b = { bg = p.overlay, fg = p.pine },
c = { bg = bg_base, fg = p.text }, c = { bg = p.base, fg = p.text },
}, },
command = { command = {
a = { bg = p.love, fg = p.base, gui = "bold" }, a = { bg = p.love, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.love }, b = { bg = p.overlay, fg = p.love },
c = { bg = bg_base, fg = p.text }, c = { bg = p.base, fg = p.text },
}, },
inactive = { inactive = {
a = { bg = bg_base, fg = p.muted, gui = "bold" }, a = { bg = p.base, fg = p.muted, gui = "bold" },
b = { bg = bg_base, fg = p.muted }, b = { bg = p.base, fg = p.muted },
c = { bg = bg_base, fg = p.muted }, c = { bg = p.base, fg = p.muted },
}, },
} }

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
---@alias Variant "main" | "moon" | "dawn" ---@alias Variant "main" | "moon" | "dawn"
---@alias Palette { base: string, surface: string, overlay: string, muted: string, subtle: string, text: string, love: string, gold: string, rose: string, pine: string, foam: string, iris: string } ---@alias Palette { base: string, surface: string, overlay: string, muted: string, subtle: string, text: string, love: string, gold: string, rose: string, pine: string, foam: string, iris: string }
---@alias PaletteColor "base" | "surface" | "overlay" | "muted" | "subtle" | "text" | "love" | "gold" | "rose" | "pine" | "foam" | "iris" | "highlight_low" | "highlight_med" | "highlight_high" ---@alias PaletteColor "base" | "surface" | "overlay" | "muted" | "subtle" | "text" | "love" | "gold" | "rose" | "pine" | "foam" | "iris" | "highlight_low" | "highlight_med" | "highlight_high"
---@alias Highlight { link: string, inherit: boolean } | { fg: string, bg: string, sp: string, bold: boolean, italic: boolean, undercurl: boolean, underline: boolean, underdouble: boolean, underdotted: boolean, underdashed: boolean, strikethrough: boolean, inherit: boolean } ---@alias Highlight { fg: string, bg: string, sp: string, bold: boolean, italic: boolean, undercurl: boolean, underline: boolean, underdouble: boolean, underdotted: boolean, underdashed: boolean, strikethrough: boolean }
local config = {} local config = {}
@ -21,12 +21,11 @@ config.options = {
---Extend background behind borders. Appearance differs based on which ---Extend background behind borders. Appearance differs based on which
---border characters you are using. ---border characters you are using.
extend_background_behind_borders = true, extend_background_behind_borders = false,
enable = { enable = {
legacy_highlights = true,
migrations = true,
terminal = true, terminal = true,
migrations = true,
}, },
styles = { styles = {
@ -35,9 +34,6 @@ config.options = {
transparency = false, transparency = false,
}, },
---@type table<string, table<string, string>>
palette = {},
---@type table<string, string | PaletteColor> ---@type table<string, string | PaletteColor>
groups = { groups = {
border = "muted", border = "muted",
@ -47,10 +43,7 @@ config.options = {
error = "love", error = "love",
hint = "iris", hint = "iris",
info = "foam", info = "foam",
ok = "leaf",
warn = "gold", warn = "gold",
note = "pine",
todo = "rose",
git_add = "foam", git_add = "foam",
git_change = "rose", git_change = "rose",
@ -63,13 +56,15 @@ config.options = {
git_text = "rose", git_text = "rose",
git_untracked = "subtle", git_untracked = "subtle",
---@type string | PaletteColor ---@type string | PaletteColor | table<string, string | PaletteColor>
h1 = "iris", headings = {
h2 = "foam", h1 = "iris",
h3 = "rose", h2 = "foam",
h4 = "gold", h3 = "rose",
h5 = "pine", h4 = "gold",
h6 = "leaf", h5 = "pine",
h6 = "foam",
},
---@deprecated Replaced by `options.highlight_groups["Normal"]` ---@deprecated Replaced by `options.highlight_groups["Normal"]`
-- background = "base", -- background = "base",
@ -77,8 +72,6 @@ config.options = {
-- comment = "subtle", -- comment = "subtle",
---@deprecated Replaced by `options.highlight_groups["@punctuation"]` ---@deprecated Replaced by `options.highlight_groups["@punctuation"]`
-- punctuation = "muted", -- punctuation = "muted",
---@deprecated Expects a table with values h1...h6
-- headings = "text",
}, },
---@type table<string, Highlight> ---@type table<string, Highlight>
@ -105,13 +98,7 @@ config.options = {
local function migrate(options) local function migrate(options)
if options.bold_vert_split then if options.bold_vert_split then
local border = options.groups.border or "muted" options.highlight_groups["VertSplit"] = { fg = "muted", bg = "muted" }
options.highlight_groups["VertSplit"] = { fg = border, bg = border }
options.highlight_groups["WinSeparator"] = { fg = border, bg = border }
end
if options.disable_background then
options.highlight_groups["Normal"] = { bg = "NONE" }
end end
if options.disable_float_background then if options.disable_float_background then
@ -132,34 +119,27 @@ local function migrate(options)
options.highlight_groups["@punctuation"] = { fg = options.groups.punctuation } options.highlight_groups["@punctuation"] = { fg = options.groups.punctuation }
end end
options.styles.transparency = (options.disable_background and options.disable_float_background) options.styles.transparency = options.disable_background or options.styles.transparency
or options.styles.transparency
-- These never actually existed, but may be set intuitively by the user -- These never actually existed, but may be set intuitively by the user
-- because of `disable_italics` existing. -- because of `disable_italics` existing.
options.styles.bold = not (options.disable_bold or options.disable_bolds) and options.styles.bold or false options.styles.bold = (options.disable_bold or options.disable_bolds) and false or options.styles.bold
-- Similar to bold options, `disable_italic` never existed but could be a -- Similar to bold options, `disable_italic` never existed but could be a
-- common typo of the actual `disable_italics`. -- common typo of the actual `disable_italics`.
options.styles.italic = not (options.disable_italic or options.disable_italics) and options.styles.italic or false options.styles.italic = (options.disable_italic or options.disable_italics) and false or options.styles.italic
-- Set h1 through h6 to the same color if only one is specified -- Set h1 through h6 to the same color if only one is specified
if type(options.groups.headings) == "string" then if type(options.groups.headings) == "string" then
options.groups.h1 = options.groups.headings options.groups.headings = {
options.groups.h2 = options.groups.headings h1 = options.groups.headings,
options.groups.h3 = options.groups.headings h2 = options.groups.headings,
options.groups.h4 = options.groups.headings h3 = options.groups.headings,
options.groups.h5 = options.groups.headings h4 = options.groups.headings,
options.groups.h6 = options.groups.headings h5 = options.groups.headings,
elseif options.groups.headings == "table" then h6 = options.groups.headings,
options.groups.h1 = options.groups.headings.h1 or options.groups.h1 }
options.groups.h2 = options.groups.headings.h2 or options.groups.h2
options.groups.h3 = options.groups.headings.h3 or options.groups.h3
options.groups.h4 = options.groups.headings.h4 or options.groups.h4
options.groups.h5 = options.groups.headings.h5 or options.groups.h5
options.groups.h6 = options.groups.headings.h6 or options.groups.h6
end end
options.groups.headings = nil
return options return options
end end

View file

@ -11,14 +11,12 @@ local variants = {
love = "#eb6f92", love = "#eb6f92",
gold = "#f6c177", gold = "#f6c177",
rose = "#ebbcba", rose = "#ebbcba",
pine = "#31748f", pine = "#3e8fb0",
foam = "#9ccfd8", foam = "#9ccfd8",
iris = "#c4a7e7", iris = "#c4a7e7",
leaf = "#95b1ac",
highlight_low = "#21202e", highlight_low = "#21202e",
highlight_med = "#403d52", highlight_med = "#403d52",
highlight_high = "#524f67", highlight_high = "#524f67",
none = "NONE",
}, },
moon = { moon = {
_nc = "#1f1d30", _nc = "#1f1d30",
@ -34,11 +32,9 @@ local variants = {
pine = "#3e8fb0", pine = "#3e8fb0",
foam = "#9ccfd8", foam = "#9ccfd8",
iris = "#c4a7e7", iris = "#c4a7e7",
leaf = "#95b1ac",
highlight_low = "#2a283e", highlight_low = "#2a283e",
highlight_med = "#44415a", highlight_med = "#44415a",
highlight_high = "#56526e", highlight_high = "#56526e",
none = "NONE",
}, },
dawn = { dawn = {
_nc = "#f8f0e7", _nc = "#f8f0e7",
@ -54,23 +50,12 @@ local variants = {
pine = "#286983", pine = "#286983",
foam = "#56949f", foam = "#56949f",
iris = "#907aa9", iris = "#907aa9",
leaf = "#6d8f89",
highlight_low = "#f4ede8", highlight_low = "#f4ede8",
highlight_med = "#dfdad9", highlight_med = "#dfdad9",
highlight_high = "#cecacd", highlight_high = "#cecacd",
none = "NONE",
}, },
} }
if options.palette ~= nil and next(options.palette) then
-- handle variant specific overrides
for variant_name, override_palette in pairs(options.palette) do
if variants[variant_name] then
variants[variant_name] = vim.tbl_extend("force", variants[variant_name], override_palette or {})
end
end
end
if variants[options.variant] ~= nil then if variants[options.variant] ~= nil then
return variants[options.variant] return variants[options.variant]
end end

View file

@ -2,43 +2,43 @@
--- https://github.com/akinsho/bufferline.nvim --- https://github.com/akinsho/bufferline.nvim
--- ---
--- @usage --- @usage
--- local highlights = require("rose-pine.plugins.bufferline") --- local highlights = require('rose-pine.plugins.bufferline')
--- require("bufferline").setup({ highlights = highlights }) --- require('bufferline').setup({ highlights = highlights })
local p = require("rose-pine.palette") local p = require("rose-pine.palette")
return { return {
-- fill = { -- fill = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- background = { -- background = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- tab = { -- tab = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
tab_selected = { tab_selected = {
fg = p.text, fg = p.text,
bg = p.overlay, bg = p.overlay,
}, },
-- tab_close = { -- tab_close = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- close_button = { -- close_button = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- close_button_visible = { -- close_button_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- close_button_selected = { -- close_button_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
buffer_visible = { buffer_visible = {
fg = p.subtle, fg = p.subtle,
@ -51,172 +51,172 @@ return {
italic = true, italic = true,
}, },
-- diagnostic = { -- diagnostic = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- diagnostic_visible = { -- diagnostic_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- diagnostic_selected = { -- diagnostic_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- }, -- },
-- info = { -- info = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- info_visible = { -- info_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- info_selected = { -- info_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- info_diagnostic = { -- info_diagnostic = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- info_diagnostic_visible = { -- info_diagnostic_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- info_diagnostic_selected = { -- info_diagnostic_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- warning = { -- warning = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- warning_visible = { -- warning_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- warning_selected = { -- warning_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- warning_diagnostic = { -- warning_diagnostic = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- warning_diagnostic_visible = { -- warning_diagnostic_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- warning_diagnostic_selected = { -- warning_diagnostic_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- sp = warning_diagnostic_fg, -- sp = warning_diagnostic_fg,
-- }, -- },
-- error = { -- error = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- error_visible = { -- error_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- error_selected = { -- error_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- error_diagnostic = { -- error_diagnostic = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- error_diagnostic_visible = { -- error_diagnostic_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- error_diagnostic_selected = { -- error_diagnostic_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- sp = "<color-value-here>", -- sp = '<color-value-here>',
-- }, -- },
-- modified = { -- modified = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- modified_visible = { -- modified_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- modified_selected = { -- modified_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- duplicate_selected = { -- duplicate_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- italic = true, -- italic = true,
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- duplicate_visible = { -- duplicate_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- italic = true, -- italic = true,
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- duplicate = { -- duplicate = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- italic = true, -- italic = true,
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- separator_selected = { -- separator_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- separator_visible = { -- separator_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- separator = { -- separator = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- indicator_selected = { -- indicator_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- }, -- },
-- pick_selected = { -- pick_selected = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- italic = true, -- italic = true,
-- }, -- },
-- pick_visible = { -- pick_visible = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- }, -- },
-- pick = { -- pick = {
-- fg = "<color-value-here>", -- fg = '<color-value-here>',
-- bg = "<color-value-here>", -- bg = '<color-value-here>',
-- bold = true, -- bold = true,
-- italic = true, -- italic = true,
-- }, -- },

View file

@ -2,7 +2,7 @@
--- https://github.com/NTBBloodbath/galaxyline.nvim --- https://github.com/NTBBloodbath/galaxyline.nvim
--- ---
--- @usage --- @usage
--- local highlights = require("rose-pine.plugins.galaxyline") --- local highlights = require('rose-pine.plugins.galaxyline')
local p = require("rose-pine.palette") local p = require("rose-pine.palette")

View file

@ -2,7 +2,7 @@
--- https://github.com/David-Kunz/markid --- https://github.com/David-Kunz/markid
--- ---
--- @usage --- @usage
--- local highlights = require("rose-pine.plugins.markid") --- local highlights = require('rose-pine.plugins.markid')
--- require("nvim-treesitter.configs").setup({ markid = { enable = true, colors = highlights } }) --- require("nvim-treesitter.configs").setup({ markid = { enable = true, colors = highlights } })
local p = require("rose-pine.palette") local p = require("rose-pine.palette")

View file

@ -1,14 +0,0 @@
--- Rosé Pine for Obsidian(epwalsh)
--- https://github.com/epwalsh/obsidian.nvim
---
--- @usage
--- local highlights = require("rose-pine.plugins.obsidian")
--- require("obsidian").setup({ ui = {hl_groups = highlights} })
local p = require("rose-pine.palette")
return {
ObsidianBullet = { fg = p.muted },
ObsidianRefText = { underline = true, fg = p.iris },
ObsidianDone = { bold = true, fg = p.foam }
}

View file

@ -2,8 +2,8 @@
--- https://github.com/akinsho/toggleterm.nvim --- https://github.com/akinsho/toggleterm.nvim
--- ---
--- @usage --- @usage
--- local highlights = require("rose-pine.plugins.toggleterm") --- local highlights = require('rose-pine.plugins.toggleterm')
--- require("toggleterm").setup({ highlights = highlights }) --- require('toggleterm').setup({ highlights = highlights })
return { return {
Normal = { link = "Normal" }, Normal = { link = "Normal" },

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) } return { byte(new_color, 16), byte(new_color, 8), byte(new_color, 0) }
end end
local color_cache = {}
---@param color string Palette key or hex value ---@param color string Palette key or hex value
function utilities.parse_color(color) local function parse_color(color)
if color_cache[color] then
return color_cache[color]
end
if color == nil then if color == nil then
print("Invalid color: " .. color) return print("Invalid color")
return nil
end end
color = color:lower() 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) color = require("rose-pine.palette")[color] or vim.api.nvim_get_color_by_name(color)
end end
color_cache[color] = color
return color return color
end end
local blend_cache = {}
---@param fg string Foreground color ---@param fg string Foreground color
---@param bg string Background color ---@param bg string Background color
---@param alpha number Between 0 (background) and 1 (foreground) ---@param alpha number Between 0 (background) and 1 (foreground)
function utilities.blend(fg, bg, alpha) local function 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 fg_rgb = color_to_rgb(fg)
local bg_rgb = color_to_rgb(bg) local bg_rgb = color_to_rgb(bg)
@ -56,10 +41,26 @@ function utilities.blend(fg, bg, alpha)
return math.floor(math.min(math.max(0, ret), 255) + 0.5) return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end end
local result = 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
blend_cache[cache_key] = result ---@param group string
return result ---@param highlight table<string, any>
function utilities.highlight(group, highlight, blend_on)
local fg = highlight.fg and parse_color(highlight.fg) or "NONE"
local bg = highlight.bg and parse_color(highlight.bg) or "NONE"
local sp = highlight.sp and parse_color(highlight.sp) or "NONE"
if highlight.blend ~= nil and (highlight.blend >= 0 and highlight.blend <= 100) and bg ~= nil then
bg = blend(bg, blend_on or require("rose-pine.palette").base, highlight.blend / 100)
end
highlight.fg = fg
highlight.bg = bg
highlight.sp = sp
-- highlight = vim.tbl_extend("force", highlight, { fg = fg, bg = bg, sp = sp })
vim.api.nvim_set_hl(0, group, highlight)
end end
return utilities return utilities

View file

@ -13,33 +13,18 @@
## Getting started ## Getting started
Install `rose-pine/neovim` using your favourite package manager: Install `rose-pine/neovim` using your favourite plugin manager:
### [pam.nvim](https://github.com/mvllow/pam.nvim) **paq-nvim**
```lua ```lua
{ source = "rose-pine/neovim", as = "rose-pine" } { 'rose-pine/neovim', as = 'rose-pine' }
``` ```
### [lazy.nvim](https://lazy.folke.io/installation) **lazy.nvim**
**Structured Setup**
```lua ```lua
-- lua/plugins/rose-pine.lua { 'rose-pine/neovim', name = 'rose-pine' }
return {
"rose-pine/neovim",
name = "rose-pine",
config = function()
vim.cmd("colorscheme rose-pine")
end
}
```
**Single file**
```lua
{ "rose-pine/neovim", name = "rose-pine" }
``` ```
## Gallery ## Gallery
@ -66,17 +51,11 @@ Rosé Pine has three variants: main, moon, and dawn. By default, `vim.o.backgrou
Colour values accept named colours from the [Rosé Pine palette](https://rosepinetheme.com/palette/ingredients/), e.g. "foam", or valid hex, e.g. "#fa8072". Colour values accept named colours from the [Rosé Pine palette](https://rosepinetheme.com/palette/ingredients/), e.g. "foam", or valid hex, e.g. "#fa8072".
```lua ```lua
require("rose-pine").setup({ require('rose-pine').setup({
variant = "auto", -- auto, main, moon, or dawn variant = "auto", -- auto, main, moon, or dawn
dark_variant = "main", -- main, moon, or dawn dark_variant = "main", -- main, moon, or dawn
dim_inactive_windows = false, dim_inactive_windows = false,
extend_background_behind_borders = true, extend_background_behind_borders = false,
enable = {
terminal = true,
legacy_highlights = true, -- Improve compatibility for previous versions of Neovim
migrations = true, -- Handle deprecated options automatically
},
styles = { styles = {
bold = true, bold = true,
@ -92,8 +71,6 @@ require("rose-pine").setup({
error = "love", error = "love",
hint = "iris", hint = "iris",
info = "foam", info = "foam",
note = "pine",
todo = "rose",
warn = "gold", warn = "gold",
git_add = "foam", git_add = "foam",
@ -107,29 +84,21 @@ require("rose-pine").setup({
git_text = "rose", git_text = "rose",
git_untracked = "subtle", git_untracked = "subtle",
h1 = "iris", headings = {
h2 = "foam", h1 = "iris",
h3 = "rose", h2 = "foam",
h4 = "gold", h3 = "rose",
h5 = "pine", h4 = "gold",
h6 = "foam", h5 = "pine",
h6 = "foam",
},
-- Alternatively, set all headings at once.
-- headings = "subtle",
}, },
palette = {
-- Override the builtin palette per variant
-- moon = {
-- base = '#18191a',
-- overlay = '#363738',
-- },
},
-- NOTE: Highlight groups are extended (merged) by default. Disable this
-- per group via `inherit = false`
highlight_groups = { highlight_groups = {
-- Comment = { fg = "foam" }, -- Comment = { fg = "foam" },
-- StatusLine = { fg = "love", bg = "love", blend = 15 },
-- VertSplit = { fg = "muted", bg = "muted" }, -- VertSplit = { fg = "muted", bg = "muted" },
-- Visual = { fg = "base", bg = "text", inherit = false },
}, },
before_highlight = function(group, highlight, palette) before_highlight = function(group, highlight, palette)
@ -145,10 +114,10 @@ require("rose-pine").setup({
end, end,
}) })
vim.cmd("colorscheme rose-pine") vim.cmd('colorscheme rose-pine')
-- vim.cmd("colorscheme rose-pine-main") -- vim.cmd('colorscheme rose-pine-main')
-- vim.cmd("colorscheme rose-pine-moon") -- vim.cmd('colorscheme rose-pine-moon')
-- vim.cmd("colorscheme rose-pine-dawn") -- vim.cmd('colorscheme rose-pine-dawn')
``` ```
> [!NOTE] > [!NOTE]
@ -156,6 +125,6 @@ vim.cmd("colorscheme rose-pine")
## Contributing ## Contributing
We welcome and appreciate contributions of any kind. Create an issue or start a discussion for any proposed changes. Pull requests are encouraged for supporting additional plugins or [treesitter improvements](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#highlights). We welcome and appreciate contributions of any kind. Create an issue or start a discussion for any proposed changes. Pull requests are encouraged for supporting additional plugins.
Feel free to update the [wiki](https://github.com/rose-pine/neovim/wiki/) with any [recipes](https://github.com/rose-pine/neovim/wiki/Recipes). Feel free to update the [wiki](https://github.com/rose-pine/neovim/wiki/) with any [recipes](https://github.com/rose-pine/neovim/wiki/Recipes).