diff options
| author | beeb5k (Vivek Tiwari) <beebeeb5k@gmail.com> | 2026-06-04 20:25:23 +0530 |
|---|---|---|
| committer | beeb5k (Vivek Tiwari) <beebeeb5k@gmail.com> | 2026-06-04 20:25:23 +0530 |
| commit | bfe5ef76b95725451707f6061d5dfa5e3b024c61 (patch) | |
| tree | e61fd46ffbb77e131edbc0ffe1019cef2d7662a9 /colors | |
| parent | 3ab5bbeda2c86b62999b5a662374c38e3ef0c01b (diff) | |
Use better Plugins
- codediff
- neogit
- nvim-surround
- hlchunk
- fff.nvim
- gitsigns
Diffstat (limited to 'colors')
| -rw-r--r-- | colors/matugen.lua | 97 |
1 files changed, 50 insertions, 47 deletions
diff --git a/colors/matugen.lua b/colors/matugen.lua index 241bdf2..73493a1 100644 --- a/colors/matugen.lua +++ b/colors/matugen.lua @@ -1,77 +1,80 @@ local present, base46 = pcall(require, "base46") if not present or not base46._DMS_SUPPORT then - vim.notify( - "base46 plugin not found or incorrect, make sure to install AvengeMedia/base46", - vim.log.levels.ERROR, - { title = "matugen integration" } - ) - return + vim.notify( + "base46 plugin not found or incorrect, make sure to install AvengeMedia/base46", + vim.log.levels.ERROR, + { title = "matugen integration" } + ) + return end local config_home = vim.env.XDG_CONFIG_HOME if config_home == nil or #config_home == 0 then - config_home = vim.fs.joinpath(vim.env.HOME, ".config") + config_home = vim.fs.joinpath(vim.env.HOME, ".config") end -local colors_file_path = vim.fs.joinpath(config_home, "nvim", "colors.json") +local colors_file_path = vim.fs.joinpath(config_home, "beestuff", "nvim-colors.json") local colors_file = io.open(colors_file_path, "r") if colors_file == nil then - vim.notify( - "cannnot read matugen colors file at '" .. colors_file_path .. "'", - vim.log.levels.ERROR, - { title = "matugen integration" } - ) - return + vim.notify( + "cannnot read matugen colors file at '" .. colors_file_path .. "'", + vim.log.levels.ERROR, + { title = "matugen integration" } + ) + return end local colors = vim.json.decode(colors_file:read("*a")) colors_file:close() local mode = colors.mode -if mode ~= nil then - if mode:match("light") then - vim.o.background = "light" - elseif mode:match("dark") then - vim.o.background = "dark" - end -end local settings = { matugenTemplateNeovimSetBackground = true } local theme_base = ("github_" .. vim.o.background) -local harmony = 0.5 +local harmony = 0.2 local theme_name = "matugen" +if mode ~= nil then + if mode:match("light") then + vim.o.background = "light" + theme_base = "flex-light" + elseif mode:match("dark") then + vim.o.background = "dark" + theme_base = "ashes" + end +end + if not _G._matugen_theme_watcher then - local uv = vim.uv or vim.loop - _G._matugen_theme_watcher = { uv.new_fs_event(), reload_timer = uv.new_timer() } + local uv = vim.uv or vim.loop + _G._matugen_theme_watcher = { uv.new_fs_event(), reload_timer = uv.new_timer() } - local debounce_time = 100 -- ms - local function handler() - _G._matugen_theme_watcher.reload_timer:stop() - _G._matugen_theme_watcher.reload_timer:start( - debounce_time, - 0, - vim.schedule_wrap(function() - base46.theme_tables[theme_name] = nil - if vim.g.colors_name == theme_name then - vim.cmd.colorscheme(theme_name) - end - _G._matugen_theme_watcher[1]:stop() - _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) - end) - ) - end - _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) + local debounce_time = 100 -- ms + local function handler() + _G._matugen_theme_watcher.reload_timer:stop() + _G._matugen_theme_watcher.reload_timer:start( + debounce_time, + 0, + vim.schedule_wrap(function() + base46.theme_tables[theme_name] = nil + if vim.g.colors_name == theme_name then + vim.cmd.colorscheme(theme_name) + end + _G._matugen_theme_watcher[1]:stop() + _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) + end) + ) + end + _G._matugen_theme_watcher[1]:start(colors_file_path, {}, handler) end if not base46.theme_tables[theme_name] or base46.theme_tables[theme_name].type ~= vim.o.background then - local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base))) - local harmonized = base46.theme_harmonize(builtin, colors.source_color, harmony) - if settings.matugenTemplateNeovimSetBackground ~= false then - harmonized = base46.theme_set_bg(harmonized, colors.background) - end + local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base))) + local harmonized = base46.theme_harmonize(builtin, colors.source_color, harmony) + if settings.matugenTemplateNeovimSetBackground ~= false then + harmonized = base46.theme_set_bg(harmonized, colors.background) + end - base46.theme_tables[theme_name] = harmonized + base46.theme_tables[theme_name] = harmonized end base46.load(theme_name) |
