mirror of
https://github.com/rose-pine/neovim.git
synced 2025-10-15 12:38:53 +02:00
Major Palette Changes
This commit is contained in:
parent
5110f23691
commit
7fbba55cb2
6 changed files with 233 additions and 234 deletions
|
|
@ -8,19 +8,19 @@ local function rgb(color)
|
|||
color = vim.api.nvim_get_color_by_name(color)
|
||||
|
||||
if color == -1 then
|
||||
color = vim.opt.background:get() == 'dark' and 000 or 255255255
|
||||
color = vim.opt.background:get() == "dark" and 000 or 255255255
|
||||
end
|
||||
|
||||
return {byte(color, 16), byte(color, 8), byte(color, 0)}
|
||||
end
|
||||
|
||||
local function parse_color(color)
|
||||
if color == nil then return print('invalid color') end
|
||||
if color == nil then return print("invalid color") end
|
||||
|
||||
color = color:lower()
|
||||
|
||||
if not color:find('#') and color ~= 'none' then
|
||||
color = require('rose-pine.palette')[color] or
|
||||
if not color:find("#") and color ~= "none" then
|
||||
color = require("rose-pine.palette")[color] or
|
||||
vim.api.nvim_get_color_by_name(color)
|
||||
end
|
||||
|
||||
|
|
@ -39,22 +39,22 @@ util.blend = function(fg, bg, alpha)
|
|||
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),
|
||||
return string.format("#%02X%02X%02X", blend_channel(1), blend_channel(2),
|
||||
blend_channel(3))
|
||||
end
|
||||
|
||||
---@param group string
|
||||
---@param color table<string, string>
|
||||
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 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 ""
|
||||
|
||||
vim.cmd(string.format('highlight %s %s %s %s %s', group, style, fg, bg, sp))
|
||||
vim.cmd(string.format("highlight %s %s %s %s %s", group, style, fg, bg, sp))
|
||||
|
||||
if color.link then
|
||||
vim.cmd(string.format('highlight! link %s %s', group, color.link))
|
||||
vim.cmd(string.format("highlight! link %s %s", group, color.link))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue