nvim-flake/nvim/plugin/base16.lua
2025-04-21 01:48:51 -04:00

41 lines
1 KiB
Lua

local colors_file = io.open(os.getenv('HOME') .. '/.cache/mutagen/colors.json', 'r')
if not colors_file then
vim.notify('Mutagen colors file not found', vim.log.levels.ERROR)
return
end
local content = colors_file:read('*all')
colors_file:close()
local ok, colors_data = pcall(vim.fn.json_decode, content)
if not ok then
vim.notify('Failed to parse Mutagen colors JSON: ' .. tostring(colors_data), vim.log.levels.ERROR)
return
end
local colors = colors_data.colors
if not colors then
vim.notify('No colors found in Mutagen JSON', vim.log.levels.ERROR)
return
end
local base16_colors = {
base00 = colors.base00,
base01 = colors.base01,
base02 = colors.base02,
base03 = colors.base03,
base04 = colors.base04,
base05 = colors.base05,
base06 = colors.base06,
base07 = colors.base07,
base08 = colors.base08,
base09 = colors.base09,
base0A = colors.base0A,
base0B = colors.base0B,
base0C = colors.base0C,
base0D = colors.base0D,
base0E = colors.base0E,
base0F = colors.base0F,
}
require('base16-colorscheme').setup(base16_colors)