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
require('rose-pine').colorscheme()
package.loaded["rose-pine.palette"] = nil
require("rose-pine").colorscheme()

View file

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

View file

@ -1,34 +1,34 @@
local p = require("rose-pine.palette")
return {
normal = {
a = {bg = p.pink, fg = p.base, gui = "bold"},
b = {bg = p.overlay, fg = p.rose},
c = {bg = p.base, fg = p.text}
},
insert = {
a = {bg = p.foam, fg = p.base, gui = "bold"},
b = {bg = p.overlay, fg = p.foam},
c = {bg = p.base, fg = p.text}
},
visual = {
a = {bg = p.iris, fg = p.base, gui = "bold"},
b = {bg = p.overlay, fg = p.iris},
c = {bg = p.base, fg = p.text}
},
replace = {
a = {bg = p.sand, fg = p.base, gui = "bold"},
b = {bg = p.overlay, fg = p.sand},
c = {bg = p.base, fg = p.text}
},
command = {
a = {bg = p.sand, fg = p.base, gui = "bold"},
b = {bg = p.overlay, fg = p.love},
c = {bg = p.base, fg = p.text}
},
inactive = {
a = {bg = p.base, fg = p.muted, gui = "bold"},
b = {bg = p.base, fg = p.muted},
c = {bg = p.base, fg = p.muted}
}
normal = {
a = { bg = p.pink, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.rose },
c = { bg = p.base, fg = p.text },
},
insert = {
a = { bg = p.foam, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.foam },
c = { bg = p.base, fg = p.text },
},
visual = {
a = { bg = p.iris, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.iris },
c = { bg = p.base, fg = p.text },
},
replace = {
a = { bg = p.sand, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.sand },
c = { bg = p.base, fg = p.text },
},
command = {
a = { bg = p.sand, fg = p.base, gui = "bold" },
b = { bg = p.overlay, fg = p.love },
c = { bg = p.base, fg = p.text },
},
inactive = {
a = { bg = p.base, fg = p.muted, gui = "bold" },
b = { 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 = {}
function M.colorscheme()
if vim.g.colors_name then vim.cmd('hi clear') end
---@param variant Variant|nil
function M.colorscheme(variant)
config.extend({ variant = variant })
vim.opt.termguicolors = true
vim.g.colors_name = "rose-pine"
vim.opt.termguicolors = true
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
for group, color in pairs(theme) do util.highlight(group, color) end
function M.setup(options)
config.extend(options)
end
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 = {
base = "#181722", -- idk
surface = "#1f1d2e", -- dark blue
overlay = "#26233a", -- dark blue
muted = "#6e6a86", -- gray?
subtle = "#908caa", -- gray?
text = "#e0def4", -- light light blue
love = "#e89b9f", -- red?
ocean = "#b2b13c", -- orange?
blu = "#8487c7", -- ???
crimson = "#fa4678", -- red
gold = "#f59d56",
rose = "#ff82b4",
calm = "#23ff87", -- green
sand = "#cecda7",
foam = "#7acfd8", -- turquoise
pink = "#ebb9bf", -- pink
iris = "#c4a7e7", --
highlight_low = "#21202e",
highlight_med = "#403d52",
highlight_high = "#524f67",
none = "NONE"
---@deprecated for backwards compatibility
_experimental_nc = "#16141f",
nc = "#16141f",
base = "#181722", -- idk
surface = "#1f1d2e", -- dark blue
overlay = "#26233a", -- dark blue
muted = "#6e6a86", -- gray?
subtle = "#908caa", -- gray?
text = "#e0def4", -- light light blue
love = "#e89b9f", -- red?
ocean = "#b2b13c", -- orange?
blu = "#8487c7", -- ???
crimson = "#fa4678", -- red
gold = "#f59d56",
rose = "#ff82b4",
calm = "#23ff87", -- green
sand = "#cecda7",
foam = "#7acfd8", -- turquoise
pink = "#ebb9bf", -- pink
iris = "#c4a7e7", --
highlight_low = "#21202e",
highlight_med = "#403d52",
highlight_high = "#524f67",
none = "NONE",
}
return palette

View file

@ -5,7 +5,7 @@
--- local highlights = require('rose-pine.plugins.bufferline')
--- require('bufferline').setup({ highlights = highlights })
local p = require('rose-pine.palette')
local p = require("rose-pine.palette")
return {
-- fill = {
@ -20,10 +20,10 @@ return {
-- fg = '<color-value-here>',
-- bg = '<color-value-here>',
-- },
-- tab_selected = {
-- fg = '<color-value-here>',
-- bg = '<color-value-here>',
-- },
tab_selected = {
fg = p.text,
bg = p.overlay,
},
-- tab_close = {
-- fg = '<color-value-here>',
-- bg = '<color-value-here>',

View file

@ -3,17 +3,17 @@
---
--- @usage
--- local highlights = require('rose-pine.plugins.galaxyline')
local p = require('rose-pine.palette')
local p = require("rose-pine.palette")
return {
bg = p.surface,
fg = p.text,
fg_alt = p.subtle,
yellow = p.gold,
cyan = p.rose,
green = p.pine,
orange = p.muted,
magenta = p.iris,
blue = p.foam,
red = p.love
bg = p.surface,
fg = p.text,
fg_alt = p.subtle,
yellow = p.gold,
cyan = p.rose,
green = p.pine,
orange = p.muted,
magenta = p.iris,
blue = p.foam,
red = p.love,
}

View file

@ -4,6 +4,6 @@
--- @usage
--- local highlights = require('rose-pine.plugins.markid')
--- 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')
--- require('toggleterm').setup({ highlights = highlights })
return {
Normal = {link = 'Normal'},
NormalFloat = {link = 'Normal'},
FloatBorder = {link = 'FloatBorder'},
SignColumn = {link = 'SignColumn'},
StatusLine = {link = 'StatusLine'},
StatusLineNC = {link = 'StatusLineNC'}
Normal = { link = "Normal" },
NormalFloat = { link = "Normal" },
FloatBorder = { link = "FloatBorder" },
SignColumn = { link = "SignColumn" },
StatusLine = { link = "StatusLine" },
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 alpha number number between 0 (background) and 1 (foreground)
util.blend = function(fg, bg, alpha)
fg = rgb(parse_color(fg))
bg = rgb(parse_color(bg))
local fg_rgb = rgb(parse_color(fg))
local bg_rgb = rgb(parse_color(bg))
local function blend_channel(i)
local ret = (alpha * fg[i] + ((1 - alpha) * bg[i]))
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end
local function blend_channel(i)
local ret = (alpha * fg_rgb[i] + ((1 - alpha) * bg_rgb[i]))
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end
return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2),
blend_channel(3))
end
---@param group string
---@param color table<string, string>
---@param color table<string, any>
util.highlight = function(group, color)
local style = color.style and "gui=" .. color.style or "gui=NONE"
local fg = color.fg and "guifg=" .. parse_color(color.fg) or "guifg=NONE"
local bg = color.bg and "guibg=" .. parse_color(color.bg) or "guibg=NONE"
local sp = color.sp and "guisp=" .. parse_color(color.sp) or ""
local fg = color.fg and parse_color(color.fg) or 'none'
local bg = color.bg and parse_color(color.bg) or 'none'
local sp = color.sp and 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
vim.cmd(string.format("highlight! link %s %s", group, color.link))
end
color = vim.tbl_extend('force', color, { fg = fg, bg = bg, sp = sp })
vim.api.nvim_set_hl(0, group, color)
end
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
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)
```