nvim/lua/custom/plugins/auto-dark-mode.lua
Jeremie Fraeys 467f005604
refactor: update remaining language and misc plugins
- Update copilot.lua, copilot-chat.lua AI integrations
- Refactor jupytext.lua, slime.lua, venv-selector.lua for Python dev
- Update dadbod.lua database tools, vimtex.lua LaTeX support
- Clean up context.lua, render-markdown.lua, solarized.lua, monokai.lua
- Update auto-dark-mode.lua, undotree.lua
2026-03-23 20:34:40 -04:00

82 lines
2.4 KiB
Lua
Executable file

local themes = require('custom.themes')
-- Define the function to set custom highlights for both themes
local function set_lsp_highlights(mode)
local hl = vim.api.nvim_set_hl
-- Shared diagnostic groups
local diagnostic_groups = {
'DiagnosticVirtualTextError',
'DiagnosticVirtualTextWarn',
'DiagnosticVirtualTextInfo',
'DiagnosticVirtualTextHint',
'DiagnosticUnderlineError',
'DiagnosticUnderlineWarn',
'DiagnosticUnderlineInfo',
'DiagnosticUnderlineHint',
}
if mode == 'dark' then
local fg = 'NONE'
local bg = '#272822'
local comment = '#75715e'
local line_nr = '#90908a'
-- Transparent background for editor
hl(0, 'Normal', { bg = 'none' })
hl(0, 'NormalNC', { bg = 'none' })
for _, group in ipairs(diagnostic_groups) do
hl(0, group, { fg = fg, bg = bg, underline = false })
end
hl(0, 'TreesitterContext', { bg = bg })
hl(0, 'TreesitterContextLineNumber', { fg = line_nr })
hl(0, 'TreesitterContextSeparator', { fg = comment })
-- Notify styling
hl(0, 'NormalFloat', { bg = bg, fg = '#f8f8f2' })
hl(0, 'FloatBorder', { bg = bg, fg = '#75715e' })
elseif mode == 'light' then
local bg = '#fdf6e3'
local fg = '#657b83'
local comment = '#586e75'
-- Transparent background for editor
hl(0, 'Normal', { bg = 'none' })
hl(0, 'NormalNC', { bg = 'none' })
hl(0, 'LspDocumentHighlight', { bg = bg, fg = fg, underline = false })
hl(0, 'DiagnosticVirtualTextError', { fg = '#dc322f' })
hl(0, 'DiagnosticVirtualTextWarn', { fg = '#b58900' })
hl(0, 'DiagnosticVirtualTextInfo', { fg = '#268bd2' })
hl(0, 'DiagnosticVirtualTextHint', { fg = '#2aa198' })
hl(0, 'TreesitterContext', { bg = 'NONE' })
hl(0, 'TreesitterContextLineNumber', { fg = comment })
hl(0, 'TreesitterContextSeparator', { fg = comment })
-- Notify styling
hl(0, 'NormalFloat', { bg = bg, fg = '#657b83' })
hl(0, 'FloatBorder', { bg = bg, fg = comment })
end
end
return {
'f-person/auto-dark-mode.nvim',
lazy = false,
priority = 1000,
opts = {
update_interval = 2000,
set_dark_mode = function()
vim.o.background = 'dark'
vim.cmd.colorscheme(themes.dark)
set_lsp_highlights('dark')
end,
set_light_mode = function()
vim.o.background = 'light'
vim.cmd.colorscheme(themes.light)
set_lsp_highlights('light')
end,
},
}