From 50018aa0305bd2c5cf91431c128895fc0121d2fa Mon Sep 17 00:00:00 2001 From: triethyl Date: Sat, 19 Jul 2025 10:19:11 -0400 Subject: working on custom neovim --- pkgs/custom-neovim/config/lua/utilities.lua | 37 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'pkgs/custom-neovim/config/lua/utilities.lua') diff --git a/pkgs/custom-neovim/config/lua/utilities.lua b/pkgs/custom-neovim/config/lua/utilities.lua index 3de4a54..77645ca 100644 --- a/pkgs/custom-neovim/config/lua/utilities.lua +++ b/pkgs/custom-neovim/config/lua/utilities.lua @@ -1,25 +1,34 @@ -utils = {} +Utils = {} -utils.mapkey = function(mode, key, desc, action) +Utils.mapkey = function(mode, key, desc, action) vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc}) end -utils.generate_theme_from_lualine = function() - local auto_theme = require("lualine.themes.auto") +Utils.generate_theme_from_highlight_groups = function() + local get_highlight_colors = function(group) + local raw_colors = vim.api.nvim_get_hl(0, {name = group}) + local decimal_to_hex = function(decimal_color) + if decimal_color == nil then return nil end + return string.format("#%06X", decimal_color) + end + return { + fg = decimal_to_hex(raw_colors.fg), + bg = decimal_to_hex(raw_colors.bg), + } + end return { modes = { - normal = auto_theme.normal.a.bg, - insert = auto_theme.insert.a.bg, - visual = auto_theme.visual.a.bg, - replace = auto_theme.replace.a.bg, - command = auto_theme.command.a.bg, - inactive = auto_theme.inactive.a.bg, + normal = get_highlight_colors("MiniStatuslineModeNormal").bg, + insert = get_highlight_colors("MiniStatuslineModeInsert").bg, + visual = get_highlight_colors("MiniStatuslineModeVisual").bg, + replace = get_highlight_colors("MiniStatuslineModeReplace").bg, + command = get_highlight_colors("MiniStatuslineModeCommand").bg, + inactive = get_highlight_colors("MiniStatuslineModeInactive").bg, }, text = { - dark = auto_theme.normal.a.fg, - light = auto_theme.normal.c.fg, + dark = get_highlight_colors("MiniStatuslineModeNormal").fg, + light = get_highlight_colors("Normal").fg, }, - background = auto_theme.normal.c.bg, + background = get_highlight_colors("Normal").bg, } end - -- cgit v1.2.3