Merge branch 'rose-pine-main'

This commit is contained in:
Eric 2023-08-24 12:45:29 -07:00
commit f7e7694d08
14 changed files with 827 additions and 683 deletions

12
.editorconfig Normal file
View file

@ -0,0 +1,12 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
[*.{yaml,yml}]
indent_size = 2
indent_style = space

View file

@ -1,3 +1,2 @@
package.loaded['rose-pine.palette'] = nil package.loaded["rose-pine.palette"] = nil
require("rose-pine").colorscheme()
require('rose-pine').colorscheme()

View file

@ -1,18 +1,18 @@
local p = require("rose-pine.palette") local p = require("rose-pine.palette")
return { return {
normal = { normal = {
a = {bg = p.surface, fg = p.rose, gui = "bold"}, a = { bg = p.surface, fg = p.rose, gui = "bold" },
b = {bg = p.surface, fg = p.text}, b = { bg = p.surface, fg = p.text },
c = {bg = p.surface, fg = p.subtle, gui = "italic"} c = { bg = p.surface, fg = p.subtle, gui = "italic" },
}, },
insert = {a = {bg = p.surface, fg = p.foam, gui = "bold"}}, insert = { a = { bg = p.surface, fg = p.foam, gui = "bold" } },
visual = {a = {bg = p.surface, fg = p.iris, gui = "bold"}}, visual = { a = { bg = p.surface, fg = p.iris, gui = "bold" } },
replace = {a = {bg = p.surface, fg = p.sand, gui = "bold"}}, replace = { a = { bg = p.surface, fg = p.sand, gui = "bold" } },
command = {a = {bg = p.surface, fg = p.love, gui = "bold"}}, command = { a = { bg = p.surface, fg = p.love, gui = "bold" } },
inactive = { inactive = {
a = {bg = p.base, fg = p.subtle, gui = "bold"}, a = { bg = p.base, fg = p.subtle, gui = "bold" },
b = {bg = p.base, fg = p.subtle}, b = { bg = p.base, fg = p.subtle },
c = {bg = p.base, fg = p.subtle, gui = "italic"} c = { bg = p.base, fg = p.subtle, gui = "italic" },
} },
} }

View file

@ -1,34 +1,34 @@
local p = require("rose-pine.palette") local p = require("rose-pine.palette")
return { return {
normal = { normal = {
a = {bg = p.pink, fg = p.base, gui = "bold"}, a = { bg = p.pink, fg = p.base, gui = "bold" },
b = {bg = p.overlay, fg = p.rose}, b = { bg = p.overlay, fg = p.rose },
c = {bg = p.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 = p.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 = p.base, fg = p.text} c = { bg = p.base, fg = p.text },
}, },
replace = { replace = {
a = {bg = p.sand, fg = p.base, gui = "bold"}, a = { bg = p.sand, fg = p.base, gui = "bold" },
b = {bg = p.overlay, fg = p.sand}, b = { bg = p.overlay, fg = p.sand },
c = {bg = p.base, fg = p.text} c = { bg = p.base, fg = p.text },
}, },
command = { command = {
a = {bg = p.sand, fg = p.base, gui = "bold"}, a = { bg = p.sand, fg = p.base, gui = "bold" },
b = {bg = p.overlay, fg = p.love}, b = { bg = p.overlay, fg = p.love },
c = {bg = p.base, fg = p.text} c = { bg = p.base, fg = p.text },
}, },
inactive = { inactive = {
a = {bg = p.base, fg = p.muted, gui = "bold"}, a = { bg = p.base, fg = p.muted, gui = "bold" },
b = {bg = p.base, fg = p.muted}, b = { bg = p.base, fg = p.muted },
c = {bg = p.base, fg = p.muted} c = { bg = p.base, fg = p.muted },
} },
} }

View file

@ -1,17 +1,22 @@
local util = require("rose-pine.util") local config = require('rose-pine.config')
local M = {} local M = {}
function M.colorscheme() ---@param variant Variant|nil
if vim.g.colors_name then vim.cmd('hi clear') end function M.colorscheme(variant)
config.extend({ variant = variant })
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.g.colors_name = "rose-pine" if vim.g.colors_name then
vim.cmd('hi clear')
vim.cmd('syntax reset')
end
vim.g.colors_name = 'rose-pine'
local theme = require("rose-pine.theme").get_theme() require('rose-pine.theme')._load(config.options)
end
-- Set theme highlights function M.setup(options)
for group, color in pairs(theme) do util.highlight(group, color) end config.extend(options)
end end
return M return M

68
lua/rose-pine/config.lua Normal file
View file

@ -0,0 +1,68 @@
---@alias Variant "main" | "moon" | "dawn"
---@alias Color { fg: string, bg: string, sp: string, bold: boolean, italic: boolean, undercurl: boolean, underline: boolean, underdouble: boolean, underdotted: boolean, underdashed: boolean, strikethrough: boolean }
local M = {}
---@class Options
M.options = {
---Set the desired variant: "auto" will follow the vim background,
---defaulting to "main" for dark and "dawn" for light. To change the dark
---variant, use `options.dark_variant = "moon"`.
---@type "auto" | Variant
variant = "auto",
---Set the desired dark variant: applies when `options.variant` is set to
---"auto" to match `vim.o.background`.
---@type Variant
dark_variant = "main",
bold_vert_split = false,
dim_nc_background = false,
disable_background = false,
disable_float_background = false,
disable_italics = false,
groups = {
background = "base",
background_nc = "nc",
panel = "surface",
panel_nc = "base",
border = "highlight_med",
comment = "muted",
link = "iris",
punctuation = "muted",
error = "crimson",
hint = "foam",
info = "iris",
warn = "gold",
git_add = "foam",
git_change = "rose",
git_delete = "crimson",
git_dirty = "rose",
git_ignore = "muted",
git_merge = "iris",
git_rename = "sand",
git_stage = "iris",
git_text = "rose",
headings = {
h1 = "iris",
h2 = "foam",
h3 = "rose",
h4 = "gold",
h5 = "sand",
h6 = "foam",
},
},
---@type table<string, Color>
highlight_groups = {},
}
---@param options Options|nil
function M.extend(options)
M.options = vim.tbl_deep_extend("force", M.options, options or {})
end
return M

View file

@ -1,25 +1,28 @@
local palette = { local palette = {
base = "#181722", -- idk ---@deprecated for backwards compatibility
surface = "#1f1d2e", -- dark blue _experimental_nc = "#16141f",
overlay = "#26233a", -- dark blue nc = "#16141f",
muted = "#6e6a86", -- gray? base = "#181722", -- idk
subtle = "#908caa", -- gray? surface = "#1f1d2e", -- dark blue
text = "#e0def4", -- light light blue overlay = "#26233a", -- dark blue
love = "#e89b9f", -- red? muted = "#6e6a86", -- gray?
ocean = "#b2b13c", -- orange? subtle = "#908caa", -- gray?
blu = "#8487c7", -- ??? text = "#e0def4", -- light light blue
crimson = "#fa4678", -- red love = "#e89b9f", -- red?
gold = "#f59d56", ocean = "#b2b13c", -- orange?
rose = "#ff82b4", blu = "#8487c7", -- ???
calm = "#23ff87", -- green crimson = "#fa4678", -- red
sand = "#cecda7", gold = "#f59d56",
foam = "#7acfd8", -- turquoise rose = "#ff82b4",
pink = "#ebb9bf", -- pink calm = "#23ff87", -- green
iris = "#c4a7e7", -- sand = "#cecda7",
highlight_low = "#21202e", foam = "#7acfd8", -- turquoise
highlight_med = "#403d52", pink = "#ebb9bf", -- pink
highlight_high = "#524f67", iris = "#c4a7e7", --
none = "NONE" highlight_low = "#21202e",
highlight_med = "#403d52",
highlight_high = "#524f67",
none = "NONE",
} }
return palette return palette

View file

@ -5,7 +5,7 @@
--- 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 = {
@ -20,10 +20,10 @@ return {
-- fg = '<color-value-here>', -- fg = '<color-value-here>',
-- bg = '<color-value-here>', -- bg = '<color-value-here>',
-- }, -- },
-- tab_selected = { tab_selected = {
-- fg = '<color-value-here>', fg = p.text,
-- bg = '<color-value-here>', bg = p.overlay,
-- }, },
-- tab_close = { -- tab_close = {
-- fg = '<color-value-here>', -- fg = '<color-value-here>',
-- bg = '<color-value-here>', -- bg = '<color-value-here>',

View file

@ -3,17 +3,17 @@
--- ---
--- @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")
return { return {
bg = p.surface, bg = p.surface,
fg = p.text, fg = p.text,
fg_alt = p.subtle, fg_alt = p.subtle,
yellow = p.gold, yellow = p.gold,
cyan = p.rose, cyan = p.rose,
green = p.pine, green = p.pine,
orange = p.muted, orange = p.muted,
magenta = p.iris, magenta = p.iris,
blue = p.foam, blue = p.foam,
red = p.love red = p.love,
} }

View file

@ -4,6 +4,6 @@
--- @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")
return {p.foam, p.rose, p.iris} return { p.foam, p.rose, p.iris }

View file

@ -5,10 +5,10 @@
--- 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" },
NormalFloat = {link = 'Normal'}, NormalFloat = { link = "Normal" },
FloatBorder = {link = 'FloatBorder'}, FloatBorder = { link = "FloatBorder" },
SignColumn = {link = 'SignColumn'}, SignColumn = { link = "SignColumn" },
StatusLine = {link = 'StatusLine'}, StatusLine = { link = "StatusLine" },
StatusLineNC = {link = 'StatusLineNC'} StatusLineNC = { link = "StatusLineNC" },
} }

File diff suppressed because it is too large Load diff

View file

@ -31,31 +31,35 @@ end
---@param bg string background color ---@param bg string background color
---@param alpha number number between 0 (background) and 1 (foreground) ---@param alpha number number between 0 (background) and 1 (foreground)
util.blend = function(fg, bg, alpha) util.blend = function(fg, bg, alpha)
fg = rgb(parse_color(fg)) local fg_rgb = rgb(parse_color(fg))
bg = rgb(parse_color(bg)) local bg_rgb = rgb(parse_color(bg))
local function blend_channel(i) local function blend_channel(i)
local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) local ret = (alpha * fg_rgb[i] + ((1 - alpha) * bg_rgb[i]))
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
return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2), return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2),
blend_channel(3)) blend_channel(3))
end end
---@param group string ---@param group string
---@param color table<string, string> ---@param color table<string, any>
util.highlight = function(group, color) util.highlight = function(group, color)
local style = color.style and "gui=" .. color.style or "gui=NONE" local fg = color.fg and parse_color(color.fg) or 'none'
local fg = color.fg and "guifg=" .. parse_color(color.fg) or "guifg=NONE" local bg = color.bg and parse_color(color.bg) or 'none'
local bg = color.bg and "guibg=" .. parse_color(color.bg) or "guibg=NONE" local sp = color.sp and parse_color(color.sp) or ''
local sp = color.sp and "guisp=" .. parse_color(color.sp) or ""
vim.cmd(string.format("highlight %s %s %s %s %s", group, style, fg, bg, sp)) if
color.blend ~= nil
and (color.blend >= 0 or color.blend <= 100)
and bg ~= nil
then
bg = util.blend(bg, parse_color('base') or '', color.blend / 100)
end
if color.link then color = vim.tbl_extend('force', color, { fg = fg, bg = bg, sp = sp })
vim.cmd(string.format("highlight! link %s %s", group, color.link)) vim.api.nvim_set_hl(0, group, color)
end
end end
return util return util

View file

@ -4,3 +4,29 @@
I often make changes to this theme, so if you want to use this theme, make a I often make changes to this theme, so if you want to use this theme, make a
fork if you don't want random changes I make. fork if you don't want random changes I make.
## Install
**[Paq](https://github.com/savq/paq-nvim)**
```lua
require('paq')({
{ 'NycRat/rose-pine', as = 'rose-pine' }
})
```
**[lazy.nvim](https://github.com/folke/lazy.nvim)**
```lua
require("lazy").setup({
{ 'NycRat/rose-pine', name = 'rose-pine' }
})
```
**[packer.nvim](https://github.com/wbthomason/packer.nvim)**
```lua
require('packer').startup(function(use)
use({ 'NycRat/rose-pine', as = 'rose-pine' })
end)
```