summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim/config/lua/utilities.lua
diff options
context:
space:
mode:
authortriethyl <triethylammonium@pm.me>2025-07-19 10:19:11 -0400
committertriethyl <triethylammonium@pm.me>2025-07-19 10:19:11 -0400
commit50018aa0305bd2c5cf91431c128895fc0121d2fa (patch)
treecaeaa248d797be65322a69afddc29bef31cd5667 /pkgs/custom-neovim/config/lua/utilities.lua
parentbf6ac5e7a9a13bcca9d0923e9caa3a6257519ca5 (diff)
working on custom neovim
Diffstat (limited to 'pkgs/custom-neovim/config/lua/utilities.lua')
-rw-r--r--pkgs/custom-neovim/config/lua/utilities.lua37
1 files changed, 23 insertions, 14 deletions
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
-