diff options
Diffstat (limited to 'lua/prismite/init.lua')
-rw-r--r-- | lua/prismite/init.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lua/prismite/init.lua b/lua/prismite/init.lua new file mode 100644 index 0000000..8fd4d02 --- /dev/null +++ b/lua/prismite/init.lua @@ -0,0 +1,53 @@ +local utils = require "prismite.utils" + +local M = {} + +local function term_color(idx, color) + vim.g["terminal_color_" .. idx] = color +end + +function M.load() + if vim.g.colors_name then + vim.cmd.hi "clear" + end + + vim.g.colors_name = "prismite" + vim.o.termguicolors = true + + local colors = require "prismite.palette" + term_color(0, colors.bg_lowest) + term_color(8, colors.bg_low) + term_color(1, colors.red) + term_color(9, colors.red_bright) + term_color(2, colors.green) + term_color(10, colors.green_bright) + term_color(3, colors.yellow) + term_color(11, colors.yellow_bright) + term_color(4, colors.blue) + term_color(12, colors.blue_bright) + term_color(5, colors.pink) + term_color(13, colors.pink_bright) + term_color(6, colors.cyan) + term_color(14, colors.cyan_bright) + term_color(7, colors.fg) + term_color(15, colors.fg_high) + + local groups = vim.tbl_deep_extend("error", {}, unpack(require "prismite.groups")) + for group, hl in pairs(groups) do + if type(hl.fg) == "table" and utils.is_oklch(hl.fg) then + hl.fg = utils.oklch2hex(hl.fg) + end + + if type(hl.bg) == "table" and utils.is_oklch(hl.bg) then + hl.bg = utils.oklch2hex(hl.bg) + end + + if type(hl.sp) == "table" and utils.is_oklch(hl.sp) then + hl.sp = utils.oklch2hex(hl.sp) + end + + vim.api.nvim_set_hl(0, group, hl) + end +end + +return M |