maxmx03.solarized.nvim/plugin/solarized.lua
Max Del Canto f0763424b3 refactor: Update Solarized Theme
The Solarized theme has been completely reworked to ensure it is a faithful and accurate port of the original work. All inconsistencies and issues have been resolved.

Added the option to enable or disable highlight groups, solarized now have docs and commands.

BREAKING CHANGE: The highlight and colors callbacks now accept only two parameters, colors and colorhelper table.
2023-06-29 10:28:46 -03:00

42 lines
1.4 KiB
Lua

vim.api.nvim_create_user_command('SolarizedColors', function()
local colors = require('solarized.palette').get_colors()
local buf = vim.api.nvim_create_buf(true, true)
local max_length = vim.tbl_count(colors)
local function color_desc(color)
local colors_desc = {
base04 = 'background tone (column/nvim-tree)',
base03 = 'background tone (main)',
base02 = 'background tone (highlight/menu/LineNr)',
base01 = 'content tone (comment)',
base00 = 'content tone (winseparator)',
base0 = 'content tone (foreground)',
base1 = 'content tone (statusline/tabline)',
base2 = 'background tone (main)',
base3 = 'background tone (highlight)',
}
local desc = colors_desc[color]
if not desc then
return ''
end
return desc
end
local line = 0
for color, hex in pairs(colors) do
if color ~= 'none' and color ~= 'name' and color ~= 'background' then
vim.api.nvim_buf_set_lines(buf, line, (line + 1), false, {
color .. string.rep('.', max_length - #color) .. ' = "' .. tostring(hex) .. '" ' .. color_desc(color),
})
line = line + 1
end
end
vim.api.nvim_set_option_value('modifiable', false, { buf = buf })
vim.api.nvim_set_option_value('filetype', 'Solarized', { buf = buf })
vim.api.nvim_buf_set_name(buf, 'Solarized Colors')
vim.api.nvim_win_set_buf(0, buf)
end, {})