From c7e430444b43b3ab63dab407a647a381b593d41e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 00:54:02 +0000 Subject: [PATCH 1/3] Initial plan From 493f265670d080e0914490568bb66adaf8e471a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 01:24:07 +0000 Subject: [PATCH 2/3] Restructure eldritch.nvim to match tokyonight.nvim architecture - Move color palettes to separate files in lua/eldritch/colors/ - Create modular highlight groups in lua/eldritch/groups/ - Update config.lua with modern options (cache, plugins system) - Update util.lua with modern helper functions (blend_bg, blend_fg, brighten, cache) - Update init.lua and theme.lua for new structure - Create types.lua for type definitions - Update lualine theme to follow new pattern - Add plugin highlight support for 30+ plugins with lazy.nvim auto-detection - Preserve all existing eldritch color palettes (default, darker, minimal) Co-authored-by: neonvoidx <25580051+neonvoidx@users.noreply.github.com> --- colors/eldritch-dark.lua | 2 +- colors/eldritch-minimal.lua | 2 +- colors/eldritch.lua | 2 +- lua/eldritch/colors.lua | 187 ---- lua/eldritch/colors/darker.lua | 46 + lua/eldritch/colors/default.lua | 46 + lua/eldritch/colors/init.lua | 103 +++ lua/eldritch/colors/minimal.lua | 46 + lua/eldritch/config.lua | 73 +- lua/eldritch/groups.lua | 578 ------------ lua/eldritch/groups/ale.lua | 14 + lua/eldritch/groups/alpha.lua | 17 + lua/eldritch/groups/barbar.lua | 53 ++ lua/eldritch/groups/base.lua | 159 ++++ lua/eldritch/groups/blink.lua | 25 + lua/eldritch/groups/bufferline.lua | 13 + lua/eldritch/groups/cmp.lua | 28 + lua/eldritch/groups/dap.lua | 15 + lua/eldritch/groups/dashboard.lua | 19 + lua/eldritch/groups/flash.lua | 16 + lua/eldritch/groups/fzf.lua | 18 + lua/eldritch/groups/gitgutter.lua | 18 + lua/eldritch/groups/gitsigns.lua | 15 + lua/eldritch/groups/hop.lua | 18 + lua/eldritch/groups/illuminate.lua | 17 + lua/eldritch/groups/indent-blankline.lua | 16 + lua/eldritch/groups/init.lua | 141 +++ lua/eldritch/groups/kinds.lua | 61 ++ lua/eldritch/groups/lazy.lua | 14 + lua/eldritch/groups/leap.lua | 18 + lua/eldritch/groups/lspsaga.lua | 34 + lua/eldritch/groups/mini_diff.lua | 15 + lua/eldritch/groups/mini_indentscope.lua | 16 + lua/eldritch/groups/navic.lua | 18 + lua/eldritch/groups/neo-tree.lua | 17 + lua/eldritch/groups/neogit.lua | 21 + lua/eldritch/groups/neotest.lua | 28 + lua/eldritch/groups/noice.lua | 32 + lua/eldritch/groups/notify.lua | 39 + lua/eldritch/groups/nvim-tree.lua | 28 + lua/eldritch/groups/rainbow.lua | 35 + lua/eldritch/groups/scrollbar.lua | 25 + lua/eldritch/groups/semantic_tokens.lua | 54 ++ lua/eldritch/groups/snacks.lua | 25 + lua/eldritch/groups/telescope.lua | 26 + lua/eldritch/groups/treesitter-context.lua | 14 + lua/eldritch/groups/treesitter.lua | 109 +++ lua/eldritch/groups/trouble.lua | 15 + lua/eldritch/groups/which-key.lua | 20 + lua/eldritch/groups/yanky.lua | 14 + lua/eldritch/init.lua | 35 +- lua/eldritch/theme.lua | 973 +-------------------- lua/eldritch/types.lua | 10 + lua/eldritch/util.lua | 240 +++-- lua/lualine/themes/_eldritch.lua | 56 ++ lua/lualine/themes/eldritch.lua | 50 +- 56 files changed, 1788 insertions(+), 1941 deletions(-) delete mode 100644 lua/eldritch/colors.lua create mode 100644 lua/eldritch/colors/darker.lua create mode 100644 lua/eldritch/colors/default.lua create mode 100644 lua/eldritch/colors/init.lua create mode 100644 lua/eldritch/colors/minimal.lua delete mode 100644 lua/eldritch/groups.lua create mode 100644 lua/eldritch/groups/ale.lua create mode 100644 lua/eldritch/groups/alpha.lua create mode 100644 lua/eldritch/groups/barbar.lua create mode 100644 lua/eldritch/groups/base.lua create mode 100644 lua/eldritch/groups/blink.lua create mode 100644 lua/eldritch/groups/bufferline.lua create mode 100644 lua/eldritch/groups/cmp.lua create mode 100644 lua/eldritch/groups/dap.lua create mode 100644 lua/eldritch/groups/dashboard.lua create mode 100644 lua/eldritch/groups/flash.lua create mode 100644 lua/eldritch/groups/fzf.lua create mode 100644 lua/eldritch/groups/gitgutter.lua create mode 100644 lua/eldritch/groups/gitsigns.lua create mode 100644 lua/eldritch/groups/hop.lua create mode 100644 lua/eldritch/groups/illuminate.lua create mode 100644 lua/eldritch/groups/indent-blankline.lua create mode 100644 lua/eldritch/groups/init.lua create mode 100644 lua/eldritch/groups/kinds.lua create mode 100644 lua/eldritch/groups/lazy.lua create mode 100644 lua/eldritch/groups/leap.lua create mode 100644 lua/eldritch/groups/lspsaga.lua create mode 100644 lua/eldritch/groups/mini_diff.lua create mode 100644 lua/eldritch/groups/mini_indentscope.lua create mode 100644 lua/eldritch/groups/navic.lua create mode 100644 lua/eldritch/groups/neo-tree.lua create mode 100644 lua/eldritch/groups/neogit.lua create mode 100644 lua/eldritch/groups/neotest.lua create mode 100644 lua/eldritch/groups/noice.lua create mode 100644 lua/eldritch/groups/notify.lua create mode 100644 lua/eldritch/groups/nvim-tree.lua create mode 100644 lua/eldritch/groups/rainbow.lua create mode 100644 lua/eldritch/groups/scrollbar.lua create mode 100644 lua/eldritch/groups/semantic_tokens.lua create mode 100644 lua/eldritch/groups/snacks.lua create mode 100644 lua/eldritch/groups/telescope.lua create mode 100644 lua/eldritch/groups/treesitter-context.lua create mode 100644 lua/eldritch/groups/treesitter.lua create mode 100644 lua/eldritch/groups/trouble.lua create mode 100644 lua/eldritch/groups/which-key.lua create mode 100644 lua/eldritch/groups/yanky.lua create mode 100644 lua/eldritch/types.lua create mode 100644 lua/lualine/themes/_eldritch.lua diff --git a/colors/eldritch-dark.lua b/colors/eldritch-dark.lua index 7e208b1..c64fea0 100644 --- a/colors/eldritch-dark.lua +++ b/colors/eldritch-dark.lua @@ -1,2 +1,2 @@ vim.g.colors_name = "eldritch-dark" -require("eldritch").load("darker") \ No newline at end of file +require("eldritch").load({ style = "darker" }) \ No newline at end of file diff --git a/colors/eldritch-minimal.lua b/colors/eldritch-minimal.lua index 0b2f4eb..887e6b1 100644 --- a/colors/eldritch-minimal.lua +++ b/colors/eldritch-minimal.lua @@ -1,2 +1,2 @@ vim.g.colors_name = "eldritch-minimal" -require("eldritch").load("minimal") +require("eldritch").load({ style = "minimal" }) diff --git a/colors/eldritch.lua b/colors/eldritch.lua index 4d531f7..a5cf310 100644 --- a/colors/eldritch.lua +++ b/colors/eldritch.lua @@ -1,2 +1,2 @@ vim.g.colors_name = "eldritch" -require("eldritch").load() \ No newline at end of file +require("eldritch").load({ style = "default" }) \ No newline at end of file diff --git a/lua/eldritch/colors.lua b/lua/eldritch/colors.lua deleted file mode 100644 index 9387271..0000000 --- a/lua/eldritch/colors.lua +++ /dev/null @@ -1,187 +0,0 @@ -local util = require("eldritch.util") - -local M = {} - ----@class Palette -M.default = { - none = "NONE", - bg_dark = "#171928", - bg = "#212337", - bg_highlight = "#292e42", - terminal_black = "#414868", - fg = "#ebfafa", - fg_dark = "#ABB4DA", - fg_gutter = "#3b4261", - fg_gutter_light = "#7081d0", - dark3 = "#6473B7", - comment = "#7081d0", - dark5 = "#5866A2", - bright_cyan = "#39DDFD", - visual = "#76639e", - bg_visual = "#76639e", - cyan = "#04d1f9", - dark_cyan = "#10A1BD", - magenta = "#a48cf2", - magenta2 = "#bf4f8e", - magenta3 = "#722f55", - pink = "#f265b5", - purple = "#a48cf2", - orange = "#f7c67f", - yellow = "#f1fc79", - dark_yellow = "#c0c95f", - green = "#37f499", - bright_green = "#00FA82", - dark_green = "#33C57F", - red = "#f16c75", - bright_red = "#f0313e", - git = { change = "#7081d0", add = "#37f499", delete = "#f16c75" }, - gitSigns = { - add = "#37f499", - change = "#7081d0", - delete = "#f16c75", - }, -} - ----@class Palette -M.darker = { - none = "NONE", - bg = "#171928", - bg_dark = "#0f101a", - bg_highlight = "#1e2033", - fg = "#d8e6e6", - fg_dark = "#8e94b8", - fg_gutter = "#2d3249", - fg_gutter_light = "#4a5584", - terminal_black = "#2a2e45", - dark3 = "#445084", - comment = "#506299", - dark5 = "#3d4775", - visual = "#554971", - bg_visual = "#554971", - bright_cyan = "#2bafcc", - cyan = "#0396b3", - dark_cyan = "#0c7a94", - magenta = "#8b75d9", - magenta2 = "#94407a", - magenta3 = "#5c2644", - pink = "#d154a1", - purple = "#8b75d9", - orange = "#d4a666", - yellow = "#ccd663", - dark_yellow = "#a1a34d", - green = "#2dcc82", - bright_green = "#00cc68", - dark_green = "#299e64", - red = "#cc5860", - bright_red = "#cc2935", - git = { - change = "#506299", - add = "#2dcc82", - delete = "#cc5860", - }, - gitSigns = { - add = "#2dcc82", - change = "#506299", - delete = "#cc5860", - }, -} - ----@class Palette -M.minimal = { - none = "NONE", - bg = "#212337", - bg_dark = "#171928", - bg_highlight = "#292e42", - terminal_black = "#414868", - cyan = "#04d1f9", - green = "#37f499", - magenta = "#a48cf2", - dark3 = "#6473B7", - comment = "#7081d0", - dark5 = "#5866A2", - fg = "#ebfafa", - fg_dark = "#ABB4DA", - fg_gutter = "#3b4261", - fg_gutter_light = "#7081d0", - bright_cyan = "#fafafa", - visual = "#76639e", - bg_visual = "#76639e", - dark_cyan = "#e0e0e0", - magenta2 = "#bf4f8e", - magenta3 = "#722f55", - pink = "#e0e0e0", - purple = "#e0e0e0", - orange = "#e0e0e0", - yellow = "#e0e0e0", - dark_yellow = "#e0e0e0", - bright_green = "#fafafa", - dark_green = "#e0e0e0", - red = "#f16c75", - bright_red = "#fafafa", - git = { change = "#e0e0e0", add = "#37f499", delete = "#f16c75" }, - gitSigns = { - add = "#37f499", - change = "#e0e0e0", - delete = "#f16c75", - }, -} - ----@return ColorScheme -function M.setup() - local config = require("eldritch.config") - local palette_name = config.options.palette or "default" - - -- Color Palette - ---@class ColorScheme: Palette - local colors = M[palette_name] or M.default - - util.bg = colors.bg - - colors.diff = { - add = util.darken(colors.green, 0.15), - delete = util.darken(colors.red, 0.15), - change = util.darken(colors.yellow, 0.15), - text = colors.cyan, - } - - colors.git.ignore = colors.dark3 - colors.black = util.darken(colors.bg, 0.8, "#000000") - colors.border_highlight = util.darken(colors.comment, 0.8) - colors.border = colors.black - - -- Popups and statusline always get a dark background - colors.bg_popup = colors.bg_dark - colors.bg_statusline = colors.bg_dark - - -- Sidebar and Floats are configurable - colors.bg_sidebar = config.options.styles.sidebars == "transparent" and colors.none - or config.options.styles.sidebars == "dark" and colors.bg_dark - or colors.bg - - colors.bg_float = config.options.styles.floats == "transparent" and colors.none - or config.options.styles.floats == "dark" and colors.bg_dark - or colors.bg - - colors.bg_visual = util.darken(colors.comment, 0.4) - colors.bg_search = colors.comment - colors.fg_sidebar = colors.fg_dark - -- colors.fg_float = config.options.styles.floats == "dark" and colors.fg_dark or colors.fg - colors.fg_float = colors.fg - - colors.error = colors.red - colors.todo = colors.green - colors.warning = colors.yellow - colors.info = colors.comment - colors.hint = colors.dark_green - - colors.delta = { - add = util.darken(colors.green, 0.45), - delete = util.darken(colors.red, 0.45), - } - - config.options.on_colors(colors) - - return colors -end - -return M diff --git a/lua/eldritch/colors/darker.lua b/lua/eldritch/colors/darker.lua new file mode 100644 index 0000000..0eee088 --- /dev/null +++ b/lua/eldritch/colors/darker.lua @@ -0,0 +1,46 @@ +---@type Palette +return { + bg = "#171928", + bg_dark = "#0f101a", + bg_highlight = "#1e2033", + fg = "#d8e6e6", + fg_dark = "#8e94b8", + fg_gutter = "#2d3249", + fg_gutter_light = "#4a5584", + terminal_black = "#2a2e45", + dark3 = "#445084", + comment = "#506299", + dark5 = "#3d4775", + bright_cyan = "#2bafcc", + cyan = "#0396b3", + dark_cyan = "#0c7a94", + magenta = "#8b75d9", + magenta2 = "#94407a", + magenta3 = "#5c2644", + pink = "#d154a1", + purple = "#8b75d9", + orange = "#d4a666", + yellow = "#ccd663", + dark_yellow = "#a1a34d", + green = "#2dcc82", + green1 = "#2dcc82", + green2 = "#2dcc82", + bright_green = "#00cc68", + dark_green = "#299e64", + teal = "#299e64", + red = "#cc5860", + red1 = "#cc5860", + bright_red = "#cc2935", + blue = "#0396b3", + blue0 = "#506299", + blue1 = "#2bafcc", + blue2 = "#0396b3", + blue5 = "#0396b3", + blue6 = "#0396b3", + blue7 = "#2d3249", + git = { + change = "#506299", + add = "#2dcc82", + delete = "#cc5860", + }, +} diff --git a/lua/eldritch/colors/default.lua b/lua/eldritch/colors/default.lua new file mode 100644 index 0000000..02dfd25 --- /dev/null +++ b/lua/eldritch/colors/default.lua @@ -0,0 +1,46 @@ +---@type Palette +return { + bg = "#212337", + bg_dark = "#171928", + bg_highlight = "#292e42", + terminal_black = "#414868", + fg = "#ebfafa", + fg_dark = "#ABB4DA", + fg_gutter = "#3b4261", + fg_gutter_light = "#7081d0", + dark3 = "#6473B7", + comment = "#7081d0", + dark5 = "#5866A2", + bright_cyan = "#39DDFD", + cyan = "#04d1f9", + dark_cyan = "#10A1BD", + magenta = "#a48cf2", + magenta2 = "#bf4f8e", + magenta3 = "#722f55", + pink = "#f265b5", + purple = "#a48cf2", + orange = "#f7c67f", + yellow = "#f1fc79", + dark_yellow = "#c0c95f", + green = "#37f499", + green1 = "#37f499", + green2 = "#37f499", + bright_green = "#00FA82", + dark_green = "#33C57F", + teal = "#33C57F", + red = "#f16c75", + red1 = "#f16c75", + bright_red = "#f0313e", + blue = "#04d1f9", + blue0 = "#7081d0", + blue1 = "#39DDFD", + blue2 = "#04d1f9", + blue5 = "#04d1f9", + blue6 = "#04d1f9", + blue7 = "#3b4261", + git = { + change = "#7081d0", + add = "#37f499", + delete = "#f16c75", + }, +} diff --git a/lua/eldritch/colors/init.lua b/lua/eldritch/colors/init.lua new file mode 100644 index 0000000..b50fba2 --- /dev/null +++ b/lua/eldritch/colors/init.lua @@ -0,0 +1,103 @@ +local Util = require("eldritch.util") + +local M = {} + +---@type table +M.styles = setmetatable({}, { + __index = function(_, style) + return vim.deepcopy(Util.mod("eldritch.colors." .. style)) + end, +}) + +---@param opts? eldritch.Config +function M.setup(opts) + opts = require("eldritch.config").extend(opts) + + local palette = M.styles[opts.style] + if type(palette) == "function" then + palette = palette(opts) --[[@as Palette]] + end + + -- Color Palette + ---@class ColorScheme: Palette + local colors = palette + + Util.bg = colors.bg + Util.fg = colors.fg + + colors.none = "NONE" + + colors.diff = { + add = Util.blend_bg(colors.green, 0.15), + delete = Util.blend_bg(colors.red, 0.15), + change = Util.blend_bg(colors.yellow, 0.15), + text = colors.cyan, + } + + colors.git.ignore = colors.dark3 + colors.black = Util.blend_bg(colors.bg, 0.8, "#000000") + colors.border_highlight = Util.blend_bg(colors.green, 0.8) + colors.border = colors.black + + -- Popups and statusline always get a dark background + colors.bg_popup = colors.bg_dark + colors.bg_statusline = colors.bg_dark + + -- Sidebar and Floats are configurable + colors.bg_sidebar = opts.styles.sidebars == "transparent" and colors.none + or opts.styles.sidebars == "dark" and colors.bg_dark + or colors.bg + + colors.bg_float = opts.styles.floats == "transparent" and colors.none + or opts.styles.floats == "dark" and colors.bg_dark + or colors.bg + + colors.bg_visual = Util.blend_bg(colors.purple, 0.4) + colors.bg_search = colors.comment + colors.fg_sidebar = colors.fg_dark + colors.fg_float = colors.fg + + colors.error = colors.red + colors.todo = colors.green + colors.warning = colors.yellow + colors.info = colors.cyan + colors.hint = colors.dark_green + + colors.rainbow = { + colors.cyan, + colors.yellow, + colors.green, + colors.teal, + colors.magenta, + colors.purple, + colors.orange, + colors.red, + } + + -- stylua: ignore + --- @class TerminalColors + colors.terminal = { + black = colors.black, + black_bright = colors.terminal_black, + red = colors.red, + red_bright = Util.brighten(colors.red), + green = colors.green, + green_bright = Util.brighten(colors.green), + yellow = colors.yellow, + yellow_bright = Util.brighten(colors.yellow), + blue = colors.blue, + blue_bright = Util.brighten(colors.blue), + magenta = colors.magenta, + magenta_bright = Util.brighten(colors.magenta), + cyan = colors.cyan, + cyan_bright = Util.brighten(colors.cyan), + white = colors.fg_dark, + white_bright = colors.fg, + } + + opts.on_colors(colors) + + return colors, opts +end + +return M diff --git a/lua/eldritch/colors/minimal.lua b/lua/eldritch/colors/minimal.lua new file mode 100644 index 0000000..92066cd --- /dev/null +++ b/lua/eldritch/colors/minimal.lua @@ -0,0 +1,46 @@ +---@type Palette +return { + bg = "#212337", + bg_dark = "#171928", + bg_highlight = "#292e42", + terminal_black = "#414868", + cyan = "#04d1f9", + green = "#37f499", + green1 = "#37f499", + green2 = "#37f499", + magenta = "#a48cf2", + dark3 = "#6473B7", + comment = "#7081d0", + dark5 = "#5866A2", + fg = "#ebfafa", + fg_dark = "#ABB4DA", + fg_gutter = "#3b4261", + fg_gutter_light = "#7081d0", + bright_cyan = "#fafafa", + dark_cyan = "#e0e0e0", + magenta2 = "#bf4f8e", + magenta3 = "#722f55", + pink = "#e0e0e0", + purple = "#e0e0e0", + orange = "#e0e0e0", + yellow = "#e0e0e0", + dark_yellow = "#e0e0e0", + bright_green = "#fafafa", + dark_green = "#e0e0e0", + teal = "#e0e0e0", + red = "#f16c75", + red1 = "#f16c75", + bright_red = "#fafafa", + blue = "#04d1f9", + blue0 = "#7081d0", + blue1 = "#fafafa", + blue2 = "#04d1f9", + blue5 = "#04d1f9", + blue6 = "#04d1f9", + blue7 = "#3b4261", + git = { + change = "#e0e0e0", + add = "#37f499", + delete = "#f16c75", + }, +} diff --git a/lua/eldritch/config.lua b/lua/eldritch/config.lua index 23b5ecf..fa5e9ec 100644 --- a/lua/eldritch/config.lua +++ b/lua/eldritch/config.lua @@ -1,11 +1,13 @@ local M = {} ----@class Config +M.version = "1.0.0" + +---@class eldritch.Config ---@field on_colors fun(colors: ColorScheme) ----@field on_highlights fun(highlights: Highlights, colors: ColorScheme) -local defaults = { +---@field on_highlights fun(highlights: eldritch.Highlights, colors: ColorScheme) +M.defaults = { + style = "default", -- The theme comes in three styles, `default`, `darker` and `minimal` transparent = false, -- Enable this to disable setting the background color - palette = "default", -- DEPRECATED: Use `vim.cmd.colorscheme eldritch-dark` or vim.cmd.colorsscheme eldritch-minimal instead to switch to the darker palette. terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim styles = { -- Style to be applied to different syntax groups @@ -15,14 +17,9 @@ local defaults = { functions = {}, variables = {}, -- Background styles. Can be "dark", "transparent" or "normal" - -- transparent will set the background color to `None` - -- dark will set background color to #171928 - -- normal or anything other than dark or transparent will set background color to #212337 - sidebars = "normal", -- style for sidebars, see below - floats = "normal", -- style for floating windows + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows }, - sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` - hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. dim_inactive = false, -- dims inactive windows lualine_bold = true, -- When `true`, section headers in the lualine theme will be bold @@ -33,36 +30,46 @@ local defaults = { --- You can override specific highlights to use other groups or a hex color --- function will be called with a Highlights and ColorScheme table - ---@param highlights Highlights + ---@param highlights eldritch.Highlights ---@param colors ColorScheme on_highlights = function(highlights, colors) end, - use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background + + cache = true, -- When set to true, the theme will be cached for better performance + + ---@type table + plugins = { + -- enable all plugins when not using lazy.nvim + -- set to false to manually enable/disable plugins + all = package.loaded.lazy == nil, + -- uses your plugin manager to automatically enable needed plugins + -- currently only lazy.nvim is supported + auto = true, + -- add any plugins here that you want to enable + -- for all possible plugins, see: + -- * https://github.com/eldritch-theme/eldritch.nvim/tree/main/lua/eldritch/groups + -- telescope = true, + }, } ----@type Config -M.options = {} --- NOTE: This is temprorary for retrocompatibility with palette option -M.initial_options = {} -- To store options from eldritch.setup() +---@type eldritch.Config +M.options = nil ----@param options Config|nil +---@param options? eldritch.Config function M.setup(options) - M.options = vim.tbl_deep_extend("force", {}, defaults, options or {}) - M.initial_options = M.options + M.options = vim.tbl_deep_extend("force", {}, M.defaults, options or {}) end ----@param options Config|nil -function M.extend(options) - local base_options = M.options - -- Check if options is properly initialized (not just an empty table) - if type(base_options) ~= "table" or vim.tbl_isempty(base_options) or not base_options.styles then - base_options = defaults - end - -- Ensure 'options' is a table before passing to vim.tbl_deep_extend - local opts_to_merge = {} - if type(options) == "table" then - opts_to_merge = options - end - M.options = vim.tbl_deep_extend("force", {}, base_options, opts_to_merge) +---@param opts? eldritch.Config +function M.extend(opts) + return opts and vim.tbl_deep_extend("force", {}, M.options or M.defaults, opts) or M.options or M.defaults end +setmetatable(M, { + __index = function(_, k) + if k == "options" then + return M.defaults + end + end, +}) + return M diff --git a/lua/eldritch/groups.lua b/lua/eldritch/groups.lua deleted file mode 100644 index ce032cb..0000000 --- a/lua/eldritch/groups.lua +++ /dev/null @@ -1,578 +0,0 @@ ----@class Highlight ----@variable.member fg string color name or "#RRGGBB" ----@variable.member foreground string same fg, color name or "#RRGGBB" ----@variable.member bg string color name or "#RRGGBB" ----@variable.member background string same bg, color name or "#RRGGBB" ----@variable.member sp string color name or "#RRGGBB" ----@variable.member special string same sg, color name or "#RRGGBB" ----@variable.member blend integer value between 0 and 100 ----@variable.member bold boolean ----@variable.member standout boolean ----@variable.member underline boolean ----@variable.member undercurl boolean ----@variable.member underdouble boolean ----@variable.member underdotted boolean ----@variable.member underdashed boolean ----@variable.member strikethrough boolean ----@variable.member italic boolean ----@variable.member reverse boolean ----@variable.member nocombine boolean ----@variable.member link string name of another highlight group to link to, see |:hi-link|. ----@variable.member default string Don't override existing definition |:hi-default| ----@variable.member ctermfg integer Sets foreground of cterm color |highlight-ctermfg| ----@variable.member ctermbg integer Sets background of cterm color |highlight-ctermbg| ----@variable.member cterm table cterm attribute map, like |highlight-args|. - ----@alias HighlightGroups table - ----setup highlight groups ----@param configs EldritchConfig ----@return HighlightGroups ----@nodiscard -local function setup(configs) - local colors = configs.colors - local endOfBuffer = { - fg = configs.show_end_of_buffer and colors.visual or colors.bg, - } - - return { - Normal = { fg = colors.fg, bg = colors.bg }, - NormalFloat = { fg = colors.fg, bg = colors.bg }, - Comment = { fg = colors.comment, italic = configs.italic_comment }, - Constant = { fg = colors.yellow }, - String = { fg = colors.yellow }, - Character = { fg = colors.pink }, - Number = { fg = colors.orange }, - Boolean = { fg = colors.cyan }, - Float = { fg = colors.orange }, - FloatBorder = { fg = colors.green }, - Operator = { fg = colors.green }, - Keyword = { fg = colors.cyan }, - Keywords = { fg = colors.cyan }, - Identifier = { fg = colors.cyan }, - Function = { fg = colors.yellow }, - Statement = { fg = colors.green }, - Conditional = { fg = colors.purple }, - Repeat = { fg = colors.purple }, - Label = { fg = colors.cyan }, - Exception = { fg = colors.green }, - PreProc = { fg = colors.yellow }, - Include = { fg = colors.green }, - Define = { fg = colors.green }, - Title = { fg = colors.cyan }, - Macro = { fg = colors.green }, - PreCondit = { fg = colors.cyan }, - Type = { fg = colors.orange }, - StorageClass = { fg = colors.purple }, - Structure = { fg = colors.yellow }, - TypeDef = { fg = colors.yellow }, - Special = { fg = colors.pink, italic = true }, - SpecialComment = { fg = colors.comment, italic = true }, - Error = { fg = colors.bright_red }, - Todo = { fg = colors.green, bold = true, italic = true }, - Underlined = { fg = colors.cyan, underline = true }, - - Cursor = { reverse = true }, - CursorLineNr = { fg = colors.green, bold = true }, - - SignColumn = { bg = colors.bg }, - - Conceal = { fg = colors.comment }, - CursorColumn = { bg = colors.black }, - CursorLine = { bg = colors.selection }, - ColorColumn = { bg = colors.selection }, - - StatusLine = { fg = colors.white, bg = colors.black }, - StatusLineNC = { fg = colors.comment }, - StatusLineTerm = { fg = colors.white, bg = colors.black }, - StatusLineTermNC = { fg = colors.comment }, - - Directory = { fg = colors.cyan }, - DiffAdd = { fg = colors.bg, bg = colors.pink }, - DiffChange = { fg = colors.orange }, - DiffDelete = { fg = colors.red }, - DiffText = { fg = colors.comment }, - - ErrorMsg = { fg = colors.bright_red }, - VertSplit = { fg = colors.black }, - WinSeparator = { fg = colors.black }, - Folded = { fg = colors.comment }, - FoldColumn = {}, - Search = { fg = colors.black, bg = colors.orange }, - IncSearch = { fg = colors.orange, bg = colors.comment }, - LineNr = { fg = colors.comment }, - MatchParen = { fg = colors.fg, underline = true }, - NonText = { fg = colors.nontext }, - Pmenu = { fg = colors.white, bg = colors.menu }, - PmenuSel = { fg = colors.white, bg = colors.selection }, - PmenuSbar = { bg = colors.bg }, - PmenuThumb = { bg = colors.selection }, - - Question = { fg = colors.green }, - QuickFixLine = { fg = colors.black, bg = colors.yellow }, - SpecialKey = { fg = colors.nontext }, - - SpellBad = { fg = colors.bright_red, underline = true }, - SpellCap = { fg = colors.yellow }, - SpellLocal = { fg = colors.yellow }, - SpellRare = { fg = colors.yellow }, - - TabLine = { fg = colors.comment }, - TabLineSel = { fg = colors.white }, - TabLineFill = { bg = colors.bg }, - Terminal = { fg = colors.white, bg = colors.black }, - Visual = { bg = colors.visual }, - VisualNOS = { fg = colors.visual }, - WarningMsg = { fg = colors.yellow }, - WildMenu = { fg = colors.black, bg = colors.white }, - - EndOfBuffer = endOfBuffer, - - -- TreeSitter - ["@error"] = { fg = colors.bright_red }, - ["@punctuation.delimiter"] = { fg = colors.fg }, - ["@punctuation.bracket"] = { fg = colors.fg }, - ["@markup.list"] = { fg = colors.cyan }, - - ["@constant"] = { fg = colors.bright_cyan }, - ["@constant.builtin"] = { fg = colors.bright_cyan }, - ["@markup.link.label.symbol"] = { fg = colors.bright_cyan }, - - ["@constant.macro"] = { fg = colors.cyan }, - ["@string.regexp"] = { fg = colors.yellow }, - ["@string"] = { fg = colors.yellow }, - ["@string.escape"] = { fg = colors.cyan }, - ["@string.special.symbol"] = { fg = colors.green }, - ["@character"] = { fg = colors.pink }, - ["@number"] = { fg = colors.green }, - ["@boolean"] = { fg = colors.green }, - ["@number.float"] = { fg = colors.pink }, - ["@annotation"] = { fg = colors.yellow }, - ["@attribute"] = { fg = colors.cyan }, - ["@module"] = { fg = colors.orange }, - - ["@function.builtin"] = { fg = colors.cyan }, - ["@function"] = { fg = colors.purple }, - ["@function.macro"] = { fg = colors.purple }, - ["@variable.parameter"] = { fg = colors.orange }, - ["@variable.parameter.reference"] = { fg = colors.orange }, - ["@function.method"] = { fg = colors.purple }, - ["@variable.member"] = { fg = colors.orange }, - ["@property"] = { fg = colors.bright_green }, - ["@constructor"] = { fg = colors.cyan }, - - ["@keyword.conditional"] = { fg = colors.purple }, - ["@keyword.repeat"] = { fg = colors.purple }, - ["@label"] = { fg = colors.cyan }, - - ["@keyword"] = { fg = colors.green }, - ["@keyword.function"] = { fg = colors.cyan }, - ["@keyword.function.ruby"] = { fg = colors.purple }, - ["@keyword.operator"] = { fg = colors.purple }, - ["@operator"] = { fg = colors.purple }, - ["@keyword.exception"] = { fg = colors.green }, - ["@type"] = { fg = colors.bright_purple }, - ["@type.builtin"] = { fg = colors.cyan, italic = true }, - ["@type.qualifier"] = { fg = colors.purple }, - ["@type.def"] = { fg = colors.yellow }, - ["@structure"] = { fg = colors.green }, - ["@keyword.include"] = { fg = colors.purple }, - - ["@variable"] = { fg = colors.red }, - ["@variable.builtin"] = { fg = colors.green }, - - ["@markup"] = { fg = colors.orange }, - ["@markup.strong"] = { fg = colors.orange, bold = true }, -- bold - ["@markup.emphasis"] = { fg = colors.yellow, italic = true }, -- italic - ["@markup.underline"] = { fg = colors.orange }, - ["@markup.heading"] = { fg = colors.purple, bold = true }, -- title - ["@markup.raw"] = { fg = colors.yellow }, -- inline code - ["@markup.link.url"] = { fg = colors.yellow, italic = true }, -- urls - ["@markup.link"] = { fg = colors.orange, bold = true }, - - ["@tag"] = { fg = colors.cyan }, - ["@tag.attribute"] = { fg = colors.pink }, - ["@tag.delimiter"] = { fg = colors.cyan }, - - -- Semantic - ["@class"] = { fg = colors.cyan }, - ["@struct"] = { fg = colors.cyan }, - ["@enum"] = { fg = colors.cyan }, - ["@enumMember"] = { fg = colors.green }, - ["@event"] = { fg = colors.cyan }, - ["@interface"] = { fg = colors.cyan }, - ["@modifier"] = { fg = colors.cyan }, - ["@regexp"] = { fg = colors.yellow }, - ["@typeParameter"] = { fg = colors.cyan }, - ["@decorator"] = { fg = colors.cyan }, - - -- LSP Semantic (0.9+) - ["@lsp.type.boolean"] = { link = "@boolean" }, - ["@lsp.type.builtinType"] = { link = "@type.builtin" }, - ["@lsp.type.comment"] = { link = "@comment" }, - ["@lsp.type.decorator"] = { link = "@attribute" }, - ["@lsp.type.deriveHelper"] = { link = "@attribute" }, - ["@lsp.type.enum"] = { link = "@type" }, - ["@lsp.type.enumMember"] = { link = "@constant" }, - ["@lsp.type.escapeSequence"] = { link = "@string.escape" }, - ["@lsp.type.formatSpecifier"] = { link = "@markup.list" }, - ["@lsp.type.generic"] = { link = "@variable" }, - ["@lsp.type.keyword"] = { link = "@keyword" }, - ["@lsp.type.namespace"] = { link = "@module" }, - ["@lsp.type.number"] = { link = "@number" }, - ["@lsp.type.operator"] = { link = "@operator" }, - ["@lsp.type.parameter"] = { link = "@variable.parameter" }, - ["@lsp.type.property"] = { link = "@property" }, - ["@lsp.type.selfKeyword"] = { link = "@variable.builtin" }, - ["@lsp.type.selfTypeKeyword"] = { link = "@variable.builtin" }, - ["@lsp.type.string"] = { link = "@string" }, - ["@lsp.type.typeAlias"] = { link = "@type.def" }, - ["@lsp.type.variable"] = {}, -- use treesitter styles for regular variables - ["@lsp.typemod.class.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.enum.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.enumMember.defaultLibrary"] = { link = "@constant.builtin" }, - ["@lsp.typemod.function.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.keyword.injected"] = { link = "@keyword" }, - ["@lsp.typemod.macro.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.method.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.operator.injected"] = { link = "@operator" }, - ["@lsp.typemod.string.injected"] = { link = "@string" }, - ["@lsp.typemod.struct.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.variable.callable"] = { link = "@function" }, - ["@lsp.typemod.variable.defaultLibrary"] = { link = "@variable.builtin" }, - ["@lsp.typemod.variable.injected"] = { link = "@variable" }, - ["@lsp.typemod.variable.static"] = { link = "@constant" }, - ["@lsp.type.namespace.python"] = { link = "@variable" }, - - -- HTML - htmlArg = { fg = colors.pink }, - htmlBold = { fg = colors.yellow, bold = true }, - htmlEndTag = { fg = colors.cyan }, - htmlH1 = { fg = colors.purple }, - htmlH2 = { fg = colors.purple }, - htmlH3 = { fg = colors.purple }, - htmlH4 = { fg = colors.purple }, - htmlH5 = { fg = colors.purple }, - htmlH6 = { fg = colors.purple }, - htmlItalic = { fg = colors.green, italic = true }, - htmlLink = { fg = colors.green, underline = true }, - htmlSpecialChar = { fg = colors.yellow }, - htmlSpecialTagName = { fg = colors.cyan }, - htmlTag = { fg = colors.cyan }, - htmlTagN = { fg = colors.cyan }, - htmlTagName = { fg = colors.cyan }, - htmlTitle = { fg = colors.white }, - - -- Markdown - markdownBlockquote = { fg = colors.yellow, italic = true }, - markdownBold = { fg = colors.orange, bold = true }, - markdownCode = { fg = colors.pink }, - markdownCodeBlock = { fg = colors.orange }, - markdownCodeDelimiter = { fg = colors.red }, - markdownH1 = { fg = colors.purple, bold = true }, - markdownH2 = { fg = colors.purple, bold = true }, - markdownH3 = { fg = colors.purple, bold = true }, - markdownH4 = { fg = colors.purple, bold = true }, - markdownH5 = { fg = colors.purple, bold = true }, - markdownH6 = { fg = colors.purple, bold = true }, - markdownHeadingDelimiter = { fg = colors.red }, - markdownHeadingRule = { fg = colors.comment }, - markdownId = { fg = colors.green }, - markdownIdDeclaration = { fg = colors.cyan }, - markdownIdDelimiter = { fg = colors.green }, - markdownItalic = { fg = colors.yellow, italic = true }, - markdownLinkDelimiter = { fg = colors.green }, - markdownLinkText = { fg = colors.purple }, - markdownListMarker = { fg = colors.cyan }, - markdownOrderedListMarker = { fg = colors.red }, - markdownRule = { fg = colors.comment }, - - -- Diff - diffAdded = { fg = colors.pink }, - diffRemoved = { fg = colors.red }, - diffFileId = { fg = colors.yellow, bold = true, reverse = true }, - diffFile = { fg = colors.nontext }, - diffNewFile = { fg = colors.pink }, - diffOldFile = { fg = colors.red }, - - debugPc = { bg = colors.menu }, - debugBreakpoint = { fg = colors.red, reverse = true }, - - -- Git Signs - GitSignsAdd = { fg = colors.bright_cyan }, - GitSignsChange = { fg = colors.cyan }, - GitSignsDelete = { fg = colors.bright_red }, - GitSignsAddLn = { fg = colors.black, bg = colors.bright_cyan }, - GitSignsChangeLn = { fg = colors.black, bg = colors.cyan }, - GitSignsDeleteLn = { fg = colors.black, bg = colors.bright_red }, - GitSignsCurrentLineBlame = { fg = colors.white }, - - -- Telescope - TelescopePromptBorder = { fg = colors.cyan }, - TelescopeResultsBorder = { fg = colors.green }, - TelescopePreviewBorder = { fg = colors.green }, - TelescopeSelection = { fg = colors.white, bg = colors.selection }, - TelescopeMultiSelection = { fg = colors.green, bg = colors.selection }, - TelescopeNormal = { fg = colors.fg, bg = configs.transparent and "NONE" or colors.bg }, - TelescopeMatching = { fg = colors.pink }, - TelescopePromptPrefix = { fg = colors.green }, - TelescopeResultsDiffDelete = { fg = colors.red }, - TelescopeResultsDiffChange = { fg = colors.cyan }, - TelescopeResultsDiffAdd = { fg = colors.pink }, - - -- Flash - FlashLabel = { bg = colors.red, fg = colors.bright_white }, - - -- Oil-Git - OilGitAdded = { fg = colors.green }, - OilGitModified = { fg = colors.yellow }, - OilGitRenamed = { fg = colors.purple }, - OilGitUntracked = { fg = colors.cyan }, - OilGitIgnored = { fg = colors.comment }, - - -- NvimTree - NvimTreeNormal = { fg = colors.fg, bg = colors.menu }, - NvimTreeVertSplit = { fg = colors.bg, bg = colors.bg }, - NvimTreeRootFolder = { fg = colors.fg, bold = true }, - NvimTreeGitDirty = { fg = colors.yellow }, - NvimTreeGitNew = { fg = colors.bright_cyan }, - NvimTreeImageFile = { fg = colors.purple }, - NvimTreeFolderIcon = { fg = colors.green }, - NvimTreeIndentMarker = { fg = colors.nontext }, - NvimTreeEmptyFolderName = { fg = colors.comment }, - NvimTreeFolderName = { fg = colors.fg }, - NvimTreeSpecialFile = { fg = colors.purple, underline = true }, - NvimTreeOpenedFolderName = { fg = colors.fg }, - NvimTreeCursorLine = { bg = colors.selection }, - NvimTreeIn = { bg = colors.selection }, - - NvimTreeEndOfBuffer = endOfBuffer, - - -- NeoTree - NeoTreeNormal = { fg = colors.fg, bg = colors.menu }, - NeoTreeNormalNC = { fg = colors.fg, bg = colors.menu }, - NeoTreeDirectoryName = { fg = colors.fg }, - NeoTreeGitUnstaged = { fg = colors.bright_magenta }, - NeoTreeGitModified = { fg = colors.bright_magenta }, - NeoTreeGitUntracked = { fg = colors.bright_cyan }, - NeoTreeDirectoryIcon = { fg = colors.green }, - NeoTreeIndentMarker = { fg = colors.nontext }, - NeoTreeDotfile = { fg = colors.comment }, - - -- Bufferline - BufferLineIndicatorSelected = { fg = colors.green }, - BufferLineFill = { bg = colors.bg }, - BufferLineBufferSelected = { bg = colors.bg }, - BufferLineSeparator = { fg = colors.black }, - - -- LSP - DiagnosticError = { fg = colors.red }, - DiagnosticWarn = { fg = colors.yellow }, - DiagnosticInfo = { fg = colors.cyan }, - DiagnosticHint = { fg = colors.cyan }, - DiagnosticSignError = { fg = colors.red }, - DiagnosticSignWarn = { fg = colors.yellow }, - DiagnosticSignInfo = { fg = colors.cyan }, - DiagnosticSignHint = { fg = colors.cyan }, - DiagnosticFloatingError = { fg = colors.red }, - DiagnosticFloatingWarn = { fg = colors.yellow }, - DiagnosticFloatingInfo = { fg = colors.cyan }, - DiagnosticFloatingHint = { fg = colors.cyan }, - DiagnosticVirtualTextError = { fg = colors.red }, - DiagnosticVirtualTextWarn = { fg = colors.yellow }, - DiagnosticVirtualTextInfo = { fg = colors.cyan }, - DiagnosticVirtualTextHint = { fg = colors.cyan }, - - LspDiagnosticsDefaultError = { fg = colors.red }, - LspDiagnosticsDefaultWarning = { fg = colors.yellow }, - LspDiagnosticsDefaultInformation = { fg = colors.cyan }, - LspDiagnosticsDefaultHint = { fg = colors.cyan }, - LspDiagnosticsUnderlineError = { fg = colors.red, undercurl = true }, - LspDiagnosticsUnderlineWarning = { fg = colors.yellow, undercurl = true }, - LspDiagnosticsUnderlineInformation = { fg = colors.cyan, undercurl = true }, - LspDiagnosticsUnderlineHint = { fg = colors.cyan, undercurl = true }, - LspReferenceText = { fg = colors.orange }, - LspReferenceRead = { fg = colors.orange }, - LspReferenceWrite = { fg = colors.orange }, - LspCodeLens = { fg = colors.cyan }, - LspInlayHint = { fg = "#969696", bg = "#2f3146" }, - - --LSP Saga - LspFloatWinNormal = { fg = colors.fg }, - LspFloatWinBorder = { fg = colors.green }, - LspSagaHoverBorder = { fg = colors.green }, - LspSagaSignatureHelpBorder = { fg = colors.green }, - LspSagaCodeActionBorder = { fg = colors.green }, - LspSagaDefPreviewBorder = { fg = colors.green }, - LspLinesDiagBorder = { fg = colors.green }, - LspSagaRenameBorder = { fg = colors.green }, - LspSagaBorderTitle = { fg = colors.cyan }, - LSPSagaDiagnosticTruncateLine = { fg = colors.comment }, - LspSagaDiagnosticBorder = { fg = colors.green }, - LspSagaShTruncateLine = { fg = colors.comment }, - LspSagaDocTruncateLine = { fg = colors.comment }, - LspSagaLspFinderBorder = { fg = colors.green }, - CodeActionNumber = { bg = "NONE", fg = colors.cyan }, - - -- IndentBlankLine - IndentBlanklineContextChar = { fg = colors.bright_red, nocombine = true }, - - -- Nvim compe - CmpItemAbbrDeprecated = { fg = colors.white, bg = colors.bg }, - CmpItemAbbrMatch = { fg = colors.cyan, bg = colors.bg }, - - -- barbar - BufferVisibleTarget = { fg = colors.red }, - BufferTabpages = { fg = colors.nontext, bg = colors.black, bold = true }, - BufferTabpageFill = { fg = colors.nontext, bg = colors.black }, - BufferCurrentSign = { fg = colors.green }, - BufferCurrentTarget = { fg = colors.red }, - BufferInactive = { fg = colors.comment, bg = colors.black, italic = true }, - BufferInactiveIndex = { fg = colors.nontext, bg = colors.black, italic = true }, - BufferInactiveMod = { fg = colors.yellow, bg = colors.black, italic = true }, - BufferInactiveSign = { fg = colors.nontext, bg = colors.black, italic = true }, - BufferInactiveTarget = { fg = colors.red, bg = colors.black, bold = true }, - - -- Compe - CompeDocumentation = { link = "Pmenu" }, - CompeDocumentationBorder = { link = "Pmenu" }, - - -- Cmp - CmpItemAbbr = { fg = colors.white, bg = colors.bg }, - CmpItemKind = { fg = colors.white, bg = colors.bg }, - CmpItemKindMethod = { link = "@function.method" }, - CmpItemKindText = { link = "@markup" }, - CmpItemKindFunction = { link = "@function" }, - CmpItemKindConstructor = { link = "@type" }, - CmpItemKindVariable = { link = "@variable" }, - CmpItemKindClass = { link = "@type" }, - CmpItemKindInterface = { link = "@type" }, - CmpItemKindModule = { link = "@module" }, - CmpItemKindProperty = { link = "@property" }, - CmpItemKindOperator = { link = "@operator" }, - CmpItemKindReference = { link = "@variable.parameter.reference" }, - CmpItemKindUnit = { link = "@variable.member" }, - CmpItemKindValue = { link = "@variable.member" }, - CmpItemKindField = { link = "@variable.member" }, - CmpItemKindEnum = { link = "@variable.member" }, - CmpItemKindKeyword = { link = "@keyword" }, - CmpItemKindSnippet = { link = "@markup" }, - CmpItemKindColor = { link = "DevIconCss" }, - CmpItemKindFile = { link = "TSURI" }, - CmpItemKindFolder = { link = "TSURI" }, - CmpItemKindEvent = { link = "@constant" }, - CmpItemKindEnumMember = { link = "@variable.member" }, - CmpItemKindConstant = { link = "@constant" }, - CmpItemKindStruct = { link = "@structure" }, - CmpItemKindTypeParameter = { link = "@variable.parameter" }, - - -- navic - NavicIconsFile = { link = "CmpItemKindFile" }, - NavicIconsModule = { link = "CmpItemKindModule" }, - NavicIconsNamespace = { link = "CmpItemKindModule" }, - NavicIconsPackage = { link = "CmpItemKindModule" }, - NavicIconsClass = { link = "CmpItemKindClass" }, - NavicIconsMethod = { link = "CmpItemKindMethod" }, - NavicIconsProperty = { link = "CmpItemKindProperty" }, - NavicIconsField = { link = "CmpItemKindField" }, - NavicIconsConstructor = { link = "CmpItemKindConstructor" }, - NavicIconsEnum = { link = "CmpItemKindEnum" }, - NavicIconsInterface = { link = "CmpItemKindInterface" }, - NavicIconsFunction = { link = "CmpItemKindFunction" }, - NavicIconsVariable = { link = "CmpItemKindVariable" }, - NavicIconsConstant = { link = "CmpItemKindConstant" }, - NavicIconsString = { link = "String" }, - NavicIconsNumber = { link = "Number" }, - NavicIconsBoolean = { link = "Boolean" }, - NavicIconsArray = { link = "CmpItemKindClass" }, - NavicIconsObject = { link = "CmpItemKindClass" }, - NavicIconsKey = { link = "CmpItemKindKeyword" }, - NavicIconsKeyword = { link = "CmpItemKindKeyword" }, - NavicIconsNull = { fg = "blue" }, - NavicIconsEnumMember = { link = "CmpItemKindEnumMember" }, - NavicIconsStruct = { link = "CmpItemKindStruct" }, - NavicIconsEvent = { link = "CmpItemKindEvent" }, - NavicIconsOperator = { link = "CmpItemKindOperator" }, - NavicIconsTypeParameter = { link = "CmpItemKindTypeParameter" }, - NavicText = { fg = "gray" }, - NavicSeparator = { fg = "gray" }, - - -- TS rainbow colors - rainbowcol1 = { fg = colors.fg }, - rainbowcol2 = { fg = colors.purple }, - rainbowcol3 = { fg = colors.cyan }, - rainbowcol4 = { fg = colors.pink }, - rainbowcol5 = { fg = colors.green }, - rainbowcol6 = { fg = colors.orange }, - rainbowcol7 = { fg = colors.fg }, - - -- Rainbow delimiter - RainbowDelimiterRed = { fg = colors.fg }, - RainbowDelimiterYellow = { fg = colors.purple }, - RainbowDelimiterBlue = { fg = colors.cyan }, - RainbowDelimiterOrange = { fg = colors.pink }, - RainbowDelimitercyan = { fg = colors.green }, - RainbowDelimiterViolet = { fg = colors.orange }, - RainbowDelimiterpurple = { fg = colors.fg }, - - -- mini.indentscope - MiniIndentscopeSymbol = { fg = "#B5629B" }, - MiniIndentscopeSymbolOff = { fg = "#B5629B" }, - - -- goolord/alpha-nvim - AlphaHeader = { fg = colors.green }, - AlphaButtons = { fg = colors.cyan }, - AlphaShortcut = { fg = colors.orange }, - AlphaFooter = { fg = colors.green, italic = true }, - - -- nvimdev/dashboard-nvim - DashboardShortCut = { fg = colors.cyan }, - DashboardHeader = { fg = colors.green }, - DashboardCenter = { fg = colors.fg }, - DashboardFooter = { fg = colors.green, italic = true }, - DashboardKey = { fg = colors.orange }, - DashboardDesc = { fg = colors.cyan }, - DashboardIcon = { fg = colors.cyan, bold = true }, - - -- dap UI - DapUIPlayPause = { fg = colors.bright_cyan }, - DapUIRestart = { fg = colors.pink }, - DapUIStop = { fg = colors.red }, - DapUIStepOver = { fg = colors.cyan }, - DapUIStepInto = { fg = colors.cyan }, - DapUIStepOut = { fg = colors.cyan }, - DapUIStepBack = { fg = colors.cyan }, - DapUIType = { fg = colors.bright_blue }, - DapUIScope = { fg = colors.bright_purple }, - DapUIModifiedValue = { fg = colors.bright_purple, bold = true }, - DapUIDecoration = { fg = colors.bright_purple }, - DapUIThread = { fg = colors.bright_cyan }, - DapUIStoppedThread = { fg = colors.bright_purple }, - DapUISource = { fg = colors.bright_blue }, - DapUILineNumber = { fg = colors.bright_purple }, - DapUIFloatBorder = { fg = colors.green }, - DapUIWatchesEmpty = { fg = colors.purple }, - DapUIWatchesValue = { fg = colors.bright_cyan }, - DapUIWatchesError = { fg = colors.purple }, - DapUIBreakpointsPath = { fg = colors.bright_purple }, - DapUIBreakpointsInfo = { fg = colors.bright_cyan }, - DapUIBreakpointsCurrentLine = { fg = colors.bright_cyan, bold = true }, - DapStoppedLine = { default = true, link = "Visual" }, - DapUIWinSelect = { fg = colors.bright_purple, bold = true }, - - -- Notify - NotifyInfoIcon = { fg = colors.pink }, - NotifyInfoTitle = { fg = colors.pink }, - NotifyInfoBorder = { fg = colors.green }, - NotifyErrorIcon = { fg = colors.red }, - NotifyErrorTitle = { fg = colors.red }, - NotifyErrorBorder = { fg = "#DD6E6B" }, - NotifyWarnIcon = { fg = colors.orange }, - NotifyWarnTitle = { fg = colors.orange }, - NotifyWarnBorder = { fg = colors.yellow }, - } -end - -return { - setup = setup, -} diff --git a/lua/eldritch/groups/ale.lua b/lua/eldritch/groups/ale.lua new file mode 100644 index 0000000..27b7d2f --- /dev/null +++ b/lua/eldritch/groups/ale.lua @@ -0,0 +1,14 @@ +local M = {} + +M.url = "https://github.com/dense-analysis/ale" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + ALEErrorSign = { fg = c.error }, + ALEWarningSign = { fg = c.warning }, + } +end + +return M diff --git a/lua/eldritch/groups/alpha.lua b/lua/eldritch/groups/alpha.lua new file mode 100644 index 0000000..10609f6 --- /dev/null +++ b/lua/eldritch/groups/alpha.lua @@ -0,0 +1,17 @@ +local M = {} + +M.url = "https://github.com/goolord/alpha-nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + AlphaShortcut = { fg = c.orange }, + AlphaHeader = { fg = c.cyan }, + AlphaHeaderLabel = { fg = c.orange }, + AlphaFooter = { fg = c.cyan }, + AlphaButtons = { fg = c.dark_cyan }, + } +end + +return M diff --git a/lua/eldritch/groups/barbar.lua b/lua/eldritch/groups/barbar.lua new file mode 100644 index 0000000..72d5f2e --- /dev/null +++ b/lua/eldritch/groups/barbar.lua @@ -0,0 +1,53 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/romgrk/barbar.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + BufferCurrent = { bg = c.bg, fg = c.fg }, + BufferCurrentERROR = { bg = c.bg, fg = c.error }, + BufferCurrentHINT = { bg = c.bg, fg = c.hint }, + BufferCurrentINFO = { bg = c.bg, fg = c.info }, + BufferCurrentWARN = { bg = c.bg, fg = c.warning }, + BufferCurrentIndex = { bg = c.bg, fg = c.info }, + BufferCurrentMod = { bg = c.bg, fg = c.warning }, + BufferCurrentSign = { bg = c.bg, fg = c.bg }, + BufferCurrentTarget = { bg = c.bg, fg = c.red }, + BufferAlternate = { bg = c.fg_gutter, fg = c.fg }, + BufferAlternateERROR = { bg = c.fg_gutter, fg = c.error }, + BufferAlternateHINT = { bg = c.fg_gutter, fg = c.hint }, + BufferAlternateIndex = { bg = c.fg_gutter, fg = c.info }, + BufferAlternateINFO = { bg = c.fg_gutter, fg = c.info }, + BufferAlternateMod = { bg = c.fg_gutter, fg = c.warning }, + BufferAlternateSign = { bg = c.fg_gutter, fg = c.info }, + BufferAlternateTarget = { bg = c.fg_gutter, fg = c.red }, + BufferAlternateWARN = { bg = c.fg_gutter, fg = c.warning }, + BufferVisible = { bg = c.bg_statusline, fg = c.fg }, + BufferVisibleERROR = { bg = c.bg_statusline, fg = c.error }, + BufferVisibleHINT = { bg = c.bg_statusline, fg = c.hint }, + BufferVisibleINFO = { bg = c.bg_statusline, fg = c.info }, + BufferVisibleWARN = { bg = c.bg_statusline, fg = c.warning }, + BufferVisibleIndex = { bg = c.bg_statusline, fg = c.info }, + BufferVisibleMod = { bg = c.bg_statusline, fg = c.warning }, + BufferVisibleSign = { bg = c.bg_statusline, fg = c.info }, + BufferVisibleTarget = { bg = c.bg_statusline, fg = c.red }, + BufferInactive = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = Util.blend_bg(c.dark5, 0.8) }, + BufferInactiveERROR = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = Util.blend_bg(c.error, 0.8) }, + BufferInactiveHINT = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = Util.blend_bg(c.hint, 0.8) }, + BufferInactiveINFO = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = Util.blend_bg(c.info, 0.8) }, + BufferInactiveWARN = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = Util.blend_bg(c.warning, 0.8) }, + BufferInactiveIndex = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = c.dark5 }, + BufferInactiveMod = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = Util.blend_bg(c.warning, 0.8) }, + BufferInactiveSign = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = c.bg }, + BufferInactiveTarget = { bg = Util.blend_bg(c.bg_highlight, 0.4), fg = c.red }, + BufferOffset = { bg = c.bg_statusline, fg = c.dark5 }, + BufferTabpageFill = { bg = Util.blend_bg(c.bg_highlight, 0.8), fg = c.dark5 }, + BufferTabpages = { bg = c.bg_statusline, fg = c.none }, + } +end + +return M diff --git a/lua/eldritch/groups/base.lua b/lua/eldritch/groups/base.lua new file mode 100644 index 0000000..61d234a --- /dev/null +++ b/lua/eldritch/groups/base.lua @@ -0,0 +1,159 @@ +local Util = require("eldritch.util") + +local M = {} + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + Foo = { bg = c.magenta2, fg = c.fg }, + + Comment = { fg = c.comment, style = opts.styles.comments }, -- any comment + ColorColumn = { bg = c.black }, -- used for the columns set with 'colorcolumn' + Conceal = { fg = c.dark5 }, -- placeholder characters substituted for concealed text (see 'conceallevel') + Cursor = { fg = c.bg, bg = c.fg }, -- character under the cursor + lCursor = { fg = c.bg, bg = c.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM = { fg = c.bg, bg = c.fg }, -- like Cursor, but used when in IME mode |CursorIM| + CursorColumn = { bg = c.bg_highlight }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + CursorLine = { bg = c.bg_highlight }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + Directory = { fg = c.cyan }, -- directory names (and other special names in listings) + DiffAdd = { bg = c.diff.add }, -- diff mode: Added line |diff.txt| + DiffChange = { bg = c.diff.change }, -- diff mode: Changed line |diff.txt| + DiffDelete = { bg = c.diff.delete }, -- diff mode: Deleted line |diff.txt| + DiffText = { fg = c.fg, bg = c.magenta3 }, -- diff mode: Changed text within a changed line |diff.txt| + EndOfBuffer = { fg = c.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + ErrorMsg = { fg = c.error }, -- error messages on the command line + VertSplit = { fg = c.purple, bold = true }, -- the column separating vertically split windows + WinSeparator = { fg = c.purple, bold = true }, -- the column separating vertically split windows + Folded = { fg = c.cyan, bg = c.fg_gutter }, -- line used for closed folds + FoldColumn = { bg = opts.transparent and c.none or c.bg, fg = c.comment }, -- 'foldcolumn' + SignColumn = { bg = opts.transparent and c.none or c.bg, fg = c.fg_gutter }, -- column where |signs| are displayed + SignColumnSB = { bg = c.bg_sidebar, fg = c.fg_gutter }, -- column where |signs| are displayed + Substitute = { bg = c.red, fg = c.black }, -- |:substitute| replacement text highlighting + LineNr = { fg = c.fg_gutter_light or c.fg_gutter }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr = { fg = c.green, bold = true }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + LineNrAbove = { fg = c.fg_gutter }, + LineNrBelow = { fg = c.fg_gutter }, + MatchParen = { fg = c.orange, bold = true }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg = { fg = c.fg_dark, bold = true }, -- 'showmode' message (e.g., "-- INSERT -- ") + MsgArea = { fg = c.fg_dark }, -- Area for messages and cmdline + MoreMsg = { fg = c.cyan }, -- |more-prompt| + NonText = { fg = c.dark3 }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + Normal = { fg = c.fg, bg = opts.transparent and c.none or c.bg }, -- normal text + NormalNC = { fg = c.fg, bg = opts.transparent and c.none or opts.dim_inactive and c.bg_dark or c.bg }, -- normal text in non-current windows + NormalSB = { fg = c.fg_sidebar, bg = c.bg_sidebar }, -- normal text in sidebar + NormalFloat = { fg = c.fg_float, bg = c.bg_float }, -- Normal text in floating windows. + FloatBorder = { fg = c.green, bg = c.bg_float }, + FloatTitle = { fg = c.cyan, bg = c.bg_float }, + Pmenu = { bg = c.bg_popup, fg = c.fg }, -- Popup menu: normal item. + PmenuMatch = { bg = c.bg_popup, fg = c.cyan }, -- Popup menu: Matched text in normal item. + PmenuSel = { bg = Util.blend_bg(c.fg_gutter, 0.8) }, -- Popup menu: selected item. + PmenuMatchSel = { bg = Util.blend_bg(c.fg_gutter, 0.8), fg = c.cyan }, -- Popup menu: Matched text in selected item. + PmenuSbar = { bg = Util.blend_fg(c.bg_popup, 0.95) }, -- Popup menu: scrollbar. + PmenuThumb = { bg = c.fg_gutter }, -- Popup menu: Thumb of the scrollbar. + Question = { fg = c.cyan }, -- |hit-enter| prompt and yes/no questions + QuickFixLine = { bg = c.bg_visual, bold = true }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + Search = { bg = c.bg_search, fg = c.fg }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + IncSearch = { bg = c.orange, fg = c.black }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + CurSearch = "IncSearch", + SpecialKey = { fg = c.dark3 }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| + SpellBad = { sp = c.error, undercurl = true }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + SpellCap = { sp = c.warning, undercurl = true }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + SpellLocal = { sp = c.info, undercurl = true }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + SpellRare = { sp = c.hint, undercurl = true }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + StatusLine = { fg = c.fg_sidebar, bg = c.bg_statusline }, -- status line of current window + StatusLineNC = { fg = c.fg_gutter, bg = c.bg_statusline }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + TabLine = { bg = c.bg_statusline, fg = c.fg_gutter }, -- tab pages line, not active tab page label + TabLineFill = { bg = opts.transparent and c.none or c.black }, -- tab pages line, where there are no labels + TabLineSel = { fg = c.black, bg = c.cyan }, -- tab pages line, active tab page label + Title = { fg = c.cyan, bold = true }, -- titles for output from ":set all", ":autocmd" etc. + Visual = { bg = c.magenta3 }, -- Visual mode selection + VisualNOS = { bg = c.magenta3 }, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg = { fg = c.warning }, -- warning messages + Whitespace = { fg = c.fg_gutter }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + WildMenu = { bg = c.bg_visual }, -- current match in 'wildmenu' completion + WinBar = "StatusLine", -- window bar + WinBarNC = "StatusLineNC", -- window bar in inactive windows + + Bold = { bold = true, fg = c.fg }, -- (preferred) any bold text + Character = { fg = c.orange }, -- a character constant: 'c', '\n' + Constant = { fg = c.red }, -- (preferred) any constant + Debug = { fg = c.orange }, -- debugging statements + Delimiter = "Special", -- character that needs attention + Error = { fg = c.error }, -- (preferred) any erroneous construct + Function = { fg = c.pink, style = opts.styles.functions }, -- function name (also: methods for classes) + Identifier = { fg = c.magenta, style = opts.styles.variables }, -- (preferred) any variable name + Italic = { italic = true, fg = c.fg }, -- (preferred) any italic text + Keyword = { fg = c.dark_cyan, style = opts.styles.keywords }, -- any other keyword + Operator = { fg = c.cyan }, -- "sizeof", "+", "*", etc. + PreProc = { fg = c.dark_cyan }, -- (preferred) generic Preprocessor + Special = { fg = c.cyan }, -- (preferred) any special symbol + Statement = { fg = c.magenta }, -- (preferred) any statement + String = { fg = c.yellow }, -- a string constant: "this is a string" + Todo = { bg = c.yellow, fg = c.bg }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX + Type = { fg = c.cyan }, -- (preferred) int, long, char, etc. + Underlined = { underline = true }, -- (preferred) text that stands out, HTML links + debugBreakpoint = { bg = Util.blend_bg(c.info, 0.1), fg = c.info }, -- used for breakpoint colors in terminal-debug + debugPC = { bg = c.bg_sidebar }, -- used for highlighting the current line in terminal-debug + dosIniLabel = "@property", + helpCommand = { bg = c.terminal_black, fg = c.cyan }, + htmlH1 = { fg = c.magenta, bold = true }, + htmlH2 = { fg = c.cyan, bold = true }, + qfFileName = { fg = c.cyan }, + qfLineNr = { fg = c.dark5 }, + + -- These groups are for the native LSP client. Some other LSP clients may + -- use these groups, or use their own. + LspReferenceText = { bg = c.fg_gutter }, -- used for highlighting "text" references + LspReferenceRead = { bg = c.fg_gutter }, -- used for highlighting "read" references + LspReferenceWrite = { bg = c.fg_gutter }, -- used for highlighting "write" references + LspSignatureActiveParameter = { bg = Util.blend_bg(c.bg_visual, 0.4), bold = true }, + LspCodeLens = { fg = c.comment }, + LspInlayHint = { bg = Util.blend_bg(c.cyan, 0.1), fg = c.dark3 }, + LspInfoBorder = { fg = c.border_highlight, bg = c.bg_float }, + + -- diagnostics + DiagnosticError = { fg = c.error }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticWarn = { fg = c.warning }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticInfo = { fg = c.info }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticHint = { fg = c.hint }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticUnnecessary = { fg = c.terminal_black }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default + DiagnosticVirtualTextError = { bg = Util.blend_bg(c.error, 0.1), fg = c.error }, -- Used for "Error" diagnostic virtual text + DiagnosticVirtualTextWarn = { bg = Util.blend_bg(c.warning, 0.1), fg = c.warning }, -- Used for "Warning" diagnostic virtual text + DiagnosticVirtualTextInfo = { bg = Util.blend_bg(c.info, 0.1), fg = c.info }, -- Used for "Information" diagnostic virtual text + DiagnosticVirtualTextHint = { bg = Util.blend_bg(c.hint, 0.1), fg = c.hint }, -- Used for "Hint" diagnostic virtual text + DiagnosticUnderlineError = { undercurl = true, sp = c.error }, -- Used to underline "Error" diagnostics + DiagnosticUnderlineWarn = { undercurl = true, sp = c.warning }, -- Used to underline "Warning" diagnostics + DiagnosticUnderlineInfo = { undercurl = true, sp = c.info }, -- Used to underline "Information" diagnostics + DiagnosticUnderlineHint = { undercurl = true, sp = c.hint }, -- Used to underline "Hint" diagnostics + + -- Health + healthError = { fg = c.error }, + healthSuccess = { fg = c.green }, + healthWarning = { fg = c.warning }, + + -- diff + diffAdded = { bg = c.diff.add, fg = c.git.add }, + diffRemoved = { bg = c.diff.delete, fg = c.git.delete }, + diffChanged = { bg = c.diff.change, fg = c.git.change }, + diffOldFile = { fg = c.cyan, bg = c.diff.delete }, + diffNewFile = { fg = c.cyan, bg = c.diff.add }, + diffFile = { fg = c.cyan }, + diffLine = { fg = c.comment }, + diffIndexLine = { fg = c.magenta }, + helpExample = { fg = c.comment }, + + -- markdown + mkdCodeDelimiter = { bg = c.terminal_black, fg = c.fg }, + mkdCodeStart = { fg = c.cyan, bold = true }, + mkdCodeEnd = { fg = c.cyan, bold = true }, + markdownHeadingDelimiter = { fg = c.orange, bold = true }, + markdownCode = { fg = c.cyan }, + markdownCodeBlock = { fg = c.cyan }, + markdownH1 = { fg = c.magenta, bold = true }, + markdownH2 = { fg = c.cyan, bold = true }, + markdownLinkText = { fg = c.cyan, underline = true }, + } +end + +return M diff --git a/lua/eldritch/groups/blink.lua b/lua/eldritch/groups/blink.lua new file mode 100644 index 0000000..82c0378 --- /dev/null +++ b/lua/eldritch/groups/blink.lua @@ -0,0 +1,25 @@ +local M = {} + +M.url = "https://github.com/Saghen/blink.cmp" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + local ret = { + BlinkCmpDoc = { fg = c.fg, bg = c.bg_highlight }, + BlinkCmpDocBorder = { fg = c.green, bg = c.bg_float }, + BlinkCmpGhostText = { fg = c.fg_gutter_light or c.fg_gutter }, + BlinkCmpKind = { fg = c.cyan, bg = c.none }, + BlinkCmpLabel = { fg = c.fg, bg = c.none }, + BlinkCmpLabelDeprecated = { fg = c.fg_gutter, bg = c.none, strikethrough = true }, + BlinkCmpLabelMatch = { fg = c.bright_cyan, bg = c.none }, + BlinkCmpMenu = { fg = c.fg, bg = c.bg_highlight }, + BlinkCmpMenuBorder = { fg = c.green, bg = c.bg }, + BlinkCmpScrollBarThumb = { fg = c.bg_highlight, bg = c.cyan }, + } + + require("eldritch.groups.kinds").kinds(ret, "BlinkCmpKind%s") + return ret +end + +return M diff --git a/lua/eldritch/groups/bufferline.lua b/lua/eldritch/groups/bufferline.lua new file mode 100644 index 0000000..d3b68e7 --- /dev/null +++ b/lua/eldritch/groups/bufferline.lua @@ -0,0 +1,13 @@ +local M = {} + +M.url = "https://github.com/akinsho/bufferline.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + BufferLineIndicatorSelected = { fg = c.git.change }, + } +end + +return M diff --git a/lua/eldritch/groups/cmp.lua b/lua/eldritch/groups/cmp.lua new file mode 100644 index 0000000..4948bf8 --- /dev/null +++ b/lua/eldritch/groups/cmp.lua @@ -0,0 +1,28 @@ +local M = {} + +M.url = "https://github.com/hrsh7th/nvim-cmp" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + local ret = { + CmpDocumentation = { fg = c.fg, bg = c.bg_float }, + CmpDocumentationBorder = { fg = c.border_highlight, bg = c.bg_float }, + CmpGhostText = { fg = c.terminal_black }, + CmpItemAbbr = { fg = c.fg, bg = c.none }, + CmpItemAbbrDeprecated = { fg = c.fg_gutter, bg = c.none, strikethrough = true }, + CmpItemAbbrMatch = { fg = c.cyan, bg = c.none }, + CmpItemAbbrMatchFuzzy = { fg = c.cyan, bg = c.none }, + CmpItemKindCodeium = { fg = c.cyan, bg = c.none }, + CmpItemKindCopilot = { fg = c.cyan, bg = c.none }, + CmpItemKindSupermaven = { fg = c.cyan, bg = c.none }, + CmpItemKindDefault = { fg = c.fg_dark, bg = c.none }, + CmpItemKindTabNine = { fg = c.cyan, bg = c.none }, + CmpItemMenu = { fg = c.comment, bg = c.none }, + } + + require("eldritch.groups.kinds").kinds(ret, "CmpItemKind%s") + return ret +end + +return M diff --git a/lua/eldritch/groups/dap.lua b/lua/eldritch/groups/dap.lua new file mode 100644 index 0000000..70ebe93 --- /dev/null +++ b/lua/eldritch/groups/dap.lua @@ -0,0 +1,15 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/mfussenegger/nvim-dap" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + DapStoppedLine = { bg = Util.blend_bg(c.warning, 0.1) }, -- Used for "Warning" diagnostic virtual text + } +end + +return M diff --git a/lua/eldritch/groups/dashboard.lua b/lua/eldritch/groups/dashboard.lua new file mode 100644 index 0000000..cf47524 --- /dev/null +++ b/lua/eldritch/groups/dashboard.lua @@ -0,0 +1,19 @@ +local M = {} + +M.url = "https://github.com/nvimdev/dashboard-nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + DashboardShortCut = { fg = c.dark_cyan }, + DashboardHeader = { fg = c.green }, + DashboardCenter = { fg = c.magenta }, + DashboardFooter = { fg = c.dark_cyan }, + DashboardKey = { fg = c.purple }, + DashboardDesc = { fg = c.cyan }, + DashboardIcon = { fg = c.green, bold = true }, + } +end + +return M diff --git a/lua/eldritch/groups/flash.lua b/lua/eldritch/groups/flash.lua new file mode 100644 index 0000000..7133ed4 --- /dev/null +++ b/lua/eldritch/groups/flash.lua @@ -0,0 +1,16 @@ +local M = {} + +M.url = "https://github.com/folke/flash.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + FlashBackdrop = { fg = c.dark3 }, + FlashLabel = { bg = c.green, bold = true, fg = c.black }, + FlashCurrent = { bg = c.bg_highlight, bold = true, fg = c.purple }, + FlashMatch = { bg = c.bg_highlight, bold = true, fg = c.pink }, + } +end + +return M diff --git a/lua/eldritch/groups/fzf.lua b/lua/eldritch/groups/fzf.lua new file mode 100644 index 0000000..2bf2c03 --- /dev/null +++ b/lua/eldritch/groups/fzf.lua @@ -0,0 +1,18 @@ +local M = {} + +M.url = "https://github.com/ibhagwan/fzf-lua" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + FzfLuaNormal = { fg = c.fg, bg = c.bg_float }, + FzfLuaBorder = { fg = c.green, bg = c.bg_float }, + FzfLuaSearch = { fg = c.fg, bg = c.bg_float }, + FzfLuaTitle = { fg = c.cyan, bg = c.bg_float }, + FzfLuaCursorLine = { bg = c.bg_highlight, fg = c.green }, + FzfLuaFzfPrompt = { bg = c.bg_float, fg = c.purple }, + } +end + +return M diff --git a/lua/eldritch/groups/gitgutter.lua b/lua/eldritch/groups/gitgutter.lua new file mode 100644 index 0000000..3f7aa66 --- /dev/null +++ b/lua/eldritch/groups/gitgutter.lua @@ -0,0 +1,18 @@ +local M = {} + +M.url = "https://github.com/airblade/vim-gitgutter" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + GitGutterAdd = { fg = c.git.add }, -- diff mode: Added line |diff.txt| + GitGutterChange = { fg = c.git.change }, -- diff mode: Changed line |diff.txt| + GitGutterDelete = { fg = c.git.delete }, -- diff mode: Deleted line |diff.txt| + GitGutterAddLineNr = { fg = c.git.add }, + GitGutterChangeLineNr = { fg = c.git.change }, + GitGutterDeleteLineNr = { fg = c.git.delete }, + } +end + +return M diff --git a/lua/eldritch/groups/gitsigns.lua b/lua/eldritch/groups/gitsigns.lua new file mode 100644 index 0000000..8af6ffd --- /dev/null +++ b/lua/eldritch/groups/gitsigns.lua @@ -0,0 +1,15 @@ +local M = {} + +M.url = "https://github.com/lewis6991/gitsigns.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + GitSignsAdd = { fg = c.git.add }, -- diff mode: Added line |diff.txt| + GitSignsChange = { fg = c.git.change }, -- diff mode: Changed line |diff.txt| + GitSignsDelete = { fg = c.git.delete }, -- diff mode: Deleted line |diff.txt| + } +end + +return M diff --git a/lua/eldritch/groups/hop.lua b/lua/eldritch/groups/hop.lua new file mode 100644 index 0000000..f835cc9 --- /dev/null +++ b/lua/eldritch/groups/hop.lua @@ -0,0 +1,18 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/phaazon/hop.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + HopNextKey = { fg = c.magenta2, bold = true }, + HopNextKey1 = { fg = c.cyan, bold = true }, + HopNextKey2 = { fg = Util.blend_bg(c.cyan, 0.6) }, + HopUnmatched = { fg = c.dark3 }, + } +end + +return M diff --git a/lua/eldritch/groups/illuminate.lua b/lua/eldritch/groups/illuminate.lua new file mode 100644 index 0000000..0a27659 --- /dev/null +++ b/lua/eldritch/groups/illuminate.lua @@ -0,0 +1,17 @@ +local M = {} + +M.url = "https://github.com/RRethy/vim-illuminate" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + illuminatedWord = { bg = c.fg_gutter }, + illuminatedCurWord = { bg = c.fg_gutter }, + IlluminatedWordText = { bg = c.fg_gutter }, + IlluminatedWordRead = { bg = c.fg_gutter }, + IlluminatedWordWrite = { bg = c.fg_gutter }, + } +end + +return M diff --git a/lua/eldritch/groups/indent-blankline.lua b/lua/eldritch/groups/indent-blankline.lua new file mode 100644 index 0000000..a53ab5a --- /dev/null +++ b/lua/eldritch/groups/indent-blankline.lua @@ -0,0 +1,16 @@ +local M = {} + +M.url = "https://github.com/lukas-reineke/indent-blankline.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + IndentBlanklineChar = { fg = c.fg_gutter, nocombine = true }, + IndentBlanklineContextChar = { fg = c.green, nocombine = true }, + IblIndent = { fg = c.fg_gutter, nocombine = true }, + IblScope = { fg = c.green, nocombine = true }, + } +end + +return M diff --git a/lua/eldritch/groups/init.lua b/lua/eldritch/groups/init.lua new file mode 100644 index 0000000..660a0ea --- /dev/null +++ b/lua/eldritch/groups/init.lua @@ -0,0 +1,141 @@ +local Config = require("eldritch.config") +local Util = require("eldritch.util") + +local M = {} + +-- stylua: ignore +M.plugins = { + ["aerial.nvim"] = "aerial", + ["ale"] = "ale", + ["alpha-nvim"] = "alpha", + ["barbar.nvim"] = "barbar", + ["blink.cmp"] = "blink", + ["bufferline.nvim"] = "bufferline", + ["dashboard-nvim"] = "dashboard", + ["flash.nvim"] = "flash", + ["fzf-lua"] = "fzf", + ["gitsigns.nvim"] = "gitsigns", + ["hop.nvim"] = "hop", + ["indent-blankline.nvim"] = "indent-blankline", + ["lazy.nvim"] = "lazy", + ["leap.nvim"] = "leap", + ["lspsaga.nvim"] = "lspsaga", + ["mini.diff"] = "mini_diff", + ["mini.indentscope"] = "mini_indentscope", + ["neo-tree.nvim"] = "neo-tree", + ["neogit"] = "neogit", + ["neotest"] = "neotest", + ["noice.nvim"] = "noice", + ["nvim-cmp"] = "cmp", + ["nvim-dap"] = "dap", + ["nvim-navic"] = "navic", + ["nvim-notify"] = "notify", + ["nvim-scrollbar"] = "scrollbar", + ["nvim-tree.lua"] = "nvim-tree", + ["nvim-treesitter-context"] = "treesitter-context", + ["rainbow-delimiters.nvim"] = "rainbow", + ["snacks.nvim"] = "snacks", + ["telescope.nvim"] = "telescope", + ["trouble.nvim"] = "trouble", + ["vim-gitgutter"] = "gitgutter", + ["vim-illuminate"] = "illuminate", + ["which-key.nvim"] = "which-key", + ["yanky.nvim"] = "yanky" +} + +local me = debug.getinfo(1, "S").source:sub(2) +me = vim.fn.fnamemodify(me, ":h") + +function M.get_group(name) + ---@type {get: eldritch.HighlightsFn, url: string} + return Util.mod("eldritch.groups." .. name) +end + +---@param colors ColorScheme +---@param opts eldritch.Config +function M.get(name, colors, opts) + local mod = M.get_group(name) + return mod.get(colors, opts) +end + +---@param colors ColorScheme +---@param opts eldritch.Config +function M.setup(colors, opts) + local groups = { + base = true, + kinds = true, + semantic_tokens = true, + treesitter = true, + } + + if opts.plugins.all then + for _, group in pairs(M.plugins) do + groups[group] = true + end + elseif opts.plugins.auto and package.loaded.lazy then + local plugins = require("lazy.core.config").plugins + for plugin, group in pairs(M.plugins) do + if plugins[plugin] then + groups[group] = true + end + end + + -- special case for mini.nvim + if plugins["mini.nvim"] then + for _, group in pairs(M.plugins) do + if group:find("^mini_") then + groups[group] = true + end + end + end + end + + -- manually enable/disable plugins + for plugin, group in pairs(M.plugins) do + local use = opts.plugins[group] + use = use == nil and opts.plugins[plugin] or use + if use ~= nil then + if type(use) == "table" then + use = use.enabled + end + groups[group] = use or nil + end + end + + local names = vim.tbl_keys(groups) + table.sort(names) + + local cache_key = opts.style + local cache = opts.cache and Util.cache.read(cache_key) + + local inputs = { + colors = colors, + plugins = names, + version = Config.version, + opts = { transparent = opts.transparent, styles = opts.styles, dim_inactive = opts.dim_inactive }, + } + + local ret = cache and vim.deep_equal(inputs, cache.inputs) and cache.groups + + if not ret then + ret = {} + -- merge highlights + for group in pairs(groups) do + local ok, hl = pcall(M.get, group, colors, opts) + if ok then + for k, v in pairs(hl) do + ret[k] = v + end + end + end + Util.resolve(ret) + if opts.cache then + Util.cache.write(cache_key, { groups = ret, inputs = inputs }) + end + end + opts.on_highlights(ret, colors) + + return ret, groups +end + +return M diff --git a/lua/eldritch/groups/kinds.lua b/lua/eldritch/groups/kinds.lua new file mode 100644 index 0000000..3bb4f44 --- /dev/null +++ b/lua/eldritch/groups/kinds.lua @@ -0,0 +1,61 @@ +local M = {} + +-- lsp symbol kind and completion kind highlights +local kinds = { + Array = "@punctuation.bracket", + Boolean = "@boolean", + Class = "@type", + Color = "Special", + Constant = "@constant", + Constructor = "@constructor", + Enum = "@lsp.type.enum", + EnumMember = "@lsp.type.enumMember", + Event = "Special", + Field = "@variable.member", + File = "Normal", + Folder = "Directory", + Function = "@function", + Interface = "@lsp.type.interface", + Key = "@variable.member", + Keyword = "@lsp.type.keyword", + Method = "@function.method", + Module = "@module", + Namespace = "@module", + Null = "@constant.builtin", + Number = "@number", + Object = "@constant", + Operator = "@operator", + Package = "@module", + Property = "@property", + Reference = "@markup.link", + Snippet = "Conceal", + String = "@string", + Struct = "@lsp.type.struct", + Unit = "@lsp.type.struct", + Text = "@markup", + TypeParameter = "@lsp.type.typeParameter", + Variable = "@variable", + Value = "@string", +} + +---@param hl? eldritch.Highlights +---@param pattern? string +function M.kinds(hl, pattern) + hl = hl or {} + for kind, link in pairs(kinds) do + local base = "LspKind" .. kind + if pattern then + hl[pattern:format(kind)] = base + else + hl[base] = link + end + end + return hl +end + +---@type eldritch.HighlightsFn +function M.get() + return M.kinds() +end + +return M diff --git a/lua/eldritch/groups/lazy.lua b/lua/eldritch/groups/lazy.lua new file mode 100644 index 0000000..59a88f8 --- /dev/null +++ b/lua/eldritch/groups/lazy.lua @@ -0,0 +1,14 @@ +local M = {} + +M.url = "https://github.com/folke/lazy.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + LazyProgressDone = { bold = true, fg = c.magenta2 }, + LazyProgressTodo = { bold = true, fg = c.fg_gutter }, + } +end + +return M diff --git a/lua/eldritch/groups/leap.lua b/lua/eldritch/groups/leap.lua new file mode 100644 index 0000000..6ee95e9 --- /dev/null +++ b/lua/eldritch/groups/leap.lua @@ -0,0 +1,18 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/ggandor/leap.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + LeapMatch = { bg = c.magenta2, fg = c.fg, bold = true }, + LeapLabelPrimary = { fg = c.magenta2, bold = true }, + LeapLabelSecondary = { fg = c.purple, bold = true }, + LeapBackdrop = { fg = c.dark3 }, + } +end + +return M diff --git a/lua/eldritch/groups/lspsaga.lua b/lua/eldritch/groups/lspsaga.lua new file mode 100644 index 0000000..bc58f32 --- /dev/null +++ b/lua/eldritch/groups/lspsaga.lua @@ -0,0 +1,34 @@ +local M = {} + +M.url = "https://github.com/nvimdev/lspsaga.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + DiagnosticWarning = "DiagnosticWarn", + DiagnosticInformation = "DiagnosticInfo", + LspFloatWinNormal = { fg = c.fg, bg = c.bg_float }, + LspFloatWinBorder = { fg = c.green }, + LspSagaHoverBorder = { fg = c.green }, + LspSagaSignatureHelpBorder = { fg = c.green }, + LspSagaCodeActionBorder = { fg = c.green }, + LspSagaDefPreviewBorder = { fg = c.green }, + LspLinesDiagBorder = { fg = c.green }, + LspSagaRenameBorder = { fg = c.green }, + LspSagaBorderTitle = { fg = c.cyan }, + LSPSagaDiagnosticTruncateLine = { fg = c.comment }, + LspSagaDiagnosticBorder = { fg = c.green }, + LspSagaShTruncateLine = { fg = c.comment }, + LspSagaDocTruncateLine = { fg = c.comment }, + LspSagaLspFinderBorder = { fg = c.green }, + CodeActionNumber = { bg = "NONE", fg = c.cyan }, + ReferencesCount = { fg = c.green }, + DefinitionCount = { fg = c.green }, + DefinitionIcon = { fg = c.cyan }, + ReferencesIcon = { fg = c.cyan }, + TargetWord = { fg = c.dark_cyan }, + } +end + +return M diff --git a/lua/eldritch/groups/mini_diff.lua b/lua/eldritch/groups/mini_diff.lua new file mode 100644 index 0000000..e9d320e --- /dev/null +++ b/lua/eldritch/groups/mini_diff.lua @@ -0,0 +1,15 @@ +local M = {} + +M.url = "https://github.com/echasnovski/mini.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + MiniDiffSignAdd = { fg = c.git.add }, -- diff mode: Added line |diff.txt| + MiniDiffSignChange = { fg = c.git.change }, -- diff mode: Changed line |diff.txt| + MiniDiffSignDelete = { fg = c.git.delete }, -- diff mode: Deleted line |diff.txt| + } +end + +return M diff --git a/lua/eldritch/groups/mini_indentscope.lua b/lua/eldritch/groups/mini_indentscope.lua new file mode 100644 index 0000000..4a09867 --- /dev/null +++ b/lua/eldritch/groups/mini_indentscope.lua @@ -0,0 +1,16 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/echasnovski/mini.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + MiniIndentscopeSymbol = { fg = c.cyan, nocombine = true }, + MiniIndentscopePrefix = { nocombine = true }, -- Make it invisible + } +end + +return M diff --git a/lua/eldritch/groups/navic.lua b/lua/eldritch/groups/navic.lua new file mode 100644 index 0000000..600cf3f --- /dev/null +++ b/lua/eldritch/groups/navic.lua @@ -0,0 +1,18 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/SmiteshP/nvim-navic" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + local ret = { + NavicSeparator = { fg = c.fg, bg = c.none }, + NavicText = { fg = c.fg, bg = c.none }, + } + require("eldritch.groups.kinds").kinds(ret, "NavicIcons%s") + return ret +end + +return M diff --git a/lua/eldritch/groups/neo-tree.lua b/lua/eldritch/groups/neo-tree.lua new file mode 100644 index 0000000..7fdba79 --- /dev/null +++ b/lua/eldritch/groups/neo-tree.lua @@ -0,0 +1,17 @@ +local M = {} + +M.url = "https://github.com/nvim-neo-tree/neo-tree.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + NeoTreeNormal = { fg = c.fg_sidebar, bg = opts.transparent and c.none or c.bg_sidebar }, + NeoTreeNormalNC = { fg = c.fg_sidebar, bg = opts.transparent and c.none or c.bg_sidebar }, + NeoTreeDimText = { fg = c.fg_gutter }, + NeoTreeTitleBar = "NeoTreeNormalNC", + NeoTreeFloatBorder = "NeoTreeNormalNC", + } +end + +return M diff --git a/lua/eldritch/groups/neogit.lua b/lua/eldritch/groups/neogit.lua new file mode 100644 index 0000000..28684f9 --- /dev/null +++ b/lua/eldritch/groups/neogit.lua @@ -0,0 +1,21 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/NeogitOrg/neogit" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + NeogitBranch = { fg = c.magenta }, + NeogitRemote = { fg = c.green }, + NeogitHunkHeader = { bg = c.bg_highlight, fg = c.fg }, + NeogitHunkHeaderHighlight = { bg = c.fg_gutter, fg = c.cyan }, + NeogitDiffContextHighlight = { bg = Util.blend_bg(c.fg_gutter, 0.5), fg = c.fg_dark }, + NeogitDiffDeleteHighlight = { fg = c.git.delete, bg = c.diff.delete }, + NeogitDiffAddHighlight = { fg = c.git.add, bg = c.diff.add }, + } +end + +return M diff --git a/lua/eldritch/groups/neotest.lua b/lua/eldritch/groups/neotest.lua new file mode 100644 index 0000000..2d6a2e4 --- /dev/null +++ b/lua/eldritch/groups/neotest.lua @@ -0,0 +1,28 @@ +local M = {} + +M.url = "https://github.com/nvim-neotest/neotest" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + NeotestPassed = { fg = c.green }, + NeotestRunning = { fg = c.yellow }, + NeotestFailed = { fg = c.red }, + NeotestSkipped = { fg = c.cyan }, + NeotestTest = { fg = c.fg_sidebar }, + NeotestNamespace = { fg = c.purple }, + NeotestFocused = { fg = c.yellow }, + NeotestFile = { fg = c.cyan }, + NeotestDir = { fg = c.cyan }, + NeotestBorder = { fg = c.cyan }, + NeotestIndent = { fg = c.fg_sidebar }, + NeotestExpandMarker = { fg = c.fg_sidebar }, + NeotestAdapterName = { fg = c.green, bold = true }, + NeotestWinSelect = { fg = c.cyan }, + NeotestMarked = { fg = c.cyan }, + NeotestTarget = { fg = c.cyan }, + } +end + +return M diff --git a/lua/eldritch/groups/noice.lua b/lua/eldritch/groups/noice.lua new file mode 100644 index 0000000..ef6ebed --- /dev/null +++ b/lua/eldritch/groups/noice.lua @@ -0,0 +1,32 @@ +local M = {} + +M.url = "https://github.com/folke/noice.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + NoiceCompletionItemKindDefault = { fg = c.fg_dark, bg = c.none }, + -- Default + NoiceCmdline = { fg = c.green, bg = c.bg_float }, + NoiceCmdlineIcon = { fg = c.green, bg = c.bg_float }, + NoiceCmdlinePopupBorder = { fg = c.green, bg = c.bg_float }, + NoiceCmdlinePopupTitle = { fg = c.green, bg = c.bg_float }, + -- Filter (shell command) + NoiceCmdlinePopupBorderFilter = { fg = c.pink, bg = c.bg_float }, + NoiceCmdlineIconFilter = { fg = c.pink, bg = c.bg_float }, + -- Lua + NoiceCmdlinePopupBorderLua = { fg = c.dark_cyan }, + NoiceCmdlineIconLua = { fg = c.dark_cyan }, + -- Help + NoiceCmdlinePopupBorderHelp = { fg = c.yellow }, + NoiceCmdlineIconHelp = { fg = c.yellow }, + -- LspProgress + NoiceLspProgressSpinner = { fg = c.cyan }, + NoiceLspProgressTitle = { fg = c.green }, + NoiceLspProgressClient = { fg = c.purple }, + NoiceMini = { bg = c.bg_highlight }, + } +end + +return M diff --git a/lua/eldritch/groups/notify.lua b/lua/eldritch/groups/notify.lua new file mode 100644 index 0000000..90a9882 --- /dev/null +++ b/lua/eldritch/groups/notify.lua @@ -0,0 +1,39 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/rcarriga/nvim-notify" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + NotifyBackground = { fg = c.fg, bg = c.bg_float }, + --- Border + NotifyERRORBorder = { fg = Util.blend_bg(c.error, 0.3), bg = opts.transparent and c.none or c.bg }, + NotifyWARNBorder = { fg = Util.blend_bg(c.warning, 0.3), bg = opts.transparent and c.none or c.bg }, + NotifyINFOBorder = { fg = Util.blend_bg(c.info, 0.3), bg = opts.transparent and c.none or c.bg }, + NotifyDEBUGBorder = { fg = Util.blend_bg(c.comment, 0.3), bg = opts.transparent and c.none or c.bg }, + NotifyTRACEBorder = { fg = Util.blend_bg(c.green, 0.3), bg = opts.transparent and c.none or c.bg }, + --- Icons + NotifyERRORIcon = { fg = c.error }, + NotifyWARNIcon = { fg = c.warning }, + NotifyINFOIcon = { fg = c.info }, + NotifyDEBUGIcon = { fg = c.comment }, + NotifyTRACEIcon = { fg = c.green }, + --- Title + NotifyERRORTitle = { fg = c.error }, + NotifyWARNTitle = { fg = c.warning }, + NotifyINFOTitle = { fg = c.info }, + NotifyDEBUGTitle = { fg = c.comment }, + NotifyTRACETitle = { fg = c.green }, + --- Body + NotifyERRORBody = { fg = c.fg, bg = opts.transparent and c.none or c.bg }, + NotifyWARNBody = { fg = c.fg, bg = opts.transparent and c.none or c.bg }, + NotifyINFOBody = { fg = c.fg, bg = opts.transparent and c.none or c.bg }, + NotifyDEBUGBody = { fg = c.fg, bg = opts.transparent and c.none or c.bg }, + NotifyTRACEBody = { fg = c.fg, bg = opts.transparent and c.none or c.bg }, + } +end + +return M diff --git a/lua/eldritch/groups/nvim-tree.lua b/lua/eldritch/groups/nvim-tree.lua new file mode 100644 index 0000000..abd320a --- /dev/null +++ b/lua/eldritch/groups/nvim-tree.lua @@ -0,0 +1,28 @@ +local M = {} + +M.url = "https://github.com/nvim-tree/nvim-tree.lua" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + NvimTreeNormal = { fg = c.fg_sidebar, bg = opts.transparent and c.none or c.bg_sidebar }, + NvimTreeWinSeparator = { + fg = opts.styles.sidebars == "transparent" and c.border or c.bg_sidebar, + bg = c.bg_sidebar, + }, + NvimTreeNormalNC = { fg = c.fg_sidebar, bg = opts.transparent and c.none or c.bg_sidebar }, + NvimTreeRootFolder = { fg = c.cyan, bold = true }, + NvimTreeGitDirty = { fg = c.git.change }, + NvimTreeGitNew = { fg = c.git.add }, + NvimTreeGitDeleted = { fg = c.git.delete }, + NvimTreeOpenedFile = { bg = c.bg_highlight }, + NvimTreeSpecialFile = { fg = c.green, underline = true }, + NvimTreeIndentMarker = { fg = c.fg_gutter }, + NvimTreeImageFile = { fg = c.fg_sidebar }, + NvimTreeSymlink = { fg = c.cyan }, + NvimTreeFolderIcon = { bg = c.none, fg = c.cyan }, + } +end + +return M diff --git a/lua/eldritch/groups/rainbow.lua b/lua/eldritch/groups/rainbow.lua new file mode 100644 index 0000000..b676506 --- /dev/null +++ b/lua/eldritch/groups/rainbow.lua @@ -0,0 +1,35 @@ +local M = {} + +M.url = "https://github.com/HiPhish/rainbow-delimiters.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + RainbowDelimiterRed = { fg = c.red }, + RainbowDelimiterOrange = { fg = c.orange }, + RainbowDelimiterYellow = { fg = c.yellow }, + RainbowDelimiterGreen = { fg = c.purple }, + RainbowDelimiterBlue = { fg = c.cyan }, + RainbowDelimiterViolet = { fg = c.green }, + RainbowDelimiterCyan = { fg = c.dark_cyan }, + -- ts-rainbow + rainbowcol1 = { fg = c.red }, + rainbowcol2 = { fg = c.yellow }, + rainbowcol3 = { fg = c.purple }, + rainbowcol4 = { fg = c.cyan }, + rainbowcol5 = { fg = c.cyan }, + rainbowcol6 = { fg = c.magenta }, + rainbowcol7 = { fg = c.green }, + -- ts-rainbow2 + TSRainbowRed = { fg = c.red }, + TSRainbowOrange = { fg = c.orange }, + TSRainbowYellow = { fg = c.yellow }, + TSRainbowGreen = { fg = c.purple }, + TSRainbowBlue = { fg = c.cyan }, + TSRainbowViolet = { fg = c.green }, + TSRainbowCyan = { fg = c.dark_cyan }, + } +end + +return M diff --git a/lua/eldritch/groups/scrollbar.lua b/lua/eldritch/groups/scrollbar.lua new file mode 100644 index 0000000..01fa1e4 --- /dev/null +++ b/lua/eldritch/groups/scrollbar.lua @@ -0,0 +1,25 @@ +local M = {} + +M.url = "https://github.com/petertriho/nvim-scrollbar" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + ScrollbarHandle = { fg = c.none, bg = c.bg_highlight }, + ScrollbarSearchHandle = { fg = c.orange, bg = c.bg_highlight }, + ScrollbarSearch = { fg = c.orange, bg = c.none }, + ScrollbarErrorHandle = { fg = c.error, bg = c.bg_highlight }, + ScrollbarError = { fg = c.error, bg = c.none }, + ScrollbarWarnHandle = { fg = c.warning, bg = c.bg_highlight }, + ScrollbarWarn = { fg = c.warning, bg = c.none }, + ScrollbarInfoHandle = { fg = c.info, bg = c.bg_highlight }, + ScrollbarInfo = { fg = c.info, bg = c.none }, + ScrollbarHintHandle = { fg = c.hint, bg = c.bg_highlight }, + ScrollbarHint = { fg = c.hint, bg = c.none }, + ScrollbarMiscHandle = { fg = c.green, bg = c.bg_highlight }, + ScrollbarMisc = { fg = c.green, bg = c.none }, + } +end + +return M diff --git a/lua/eldritch/groups/semantic_tokens.lua b/lua/eldritch/groups/semantic_tokens.lua new file mode 100644 index 0000000..9fff699 --- /dev/null +++ b/lua/eldritch/groups/semantic_tokens.lua @@ -0,0 +1,54 @@ +local Util = require("eldritch.util") + +local M = {} + +---@type eldritch.HighlightsFn +function M.get(c) + -- stylua: ignore + return { + ["@lsp.type.boolean"] = "@boolean", + ["@lsp.type.builtinType"] = "@type.builtin", + ["@lsp.type.comment"] = "@comment", + ["@lsp.type.decorator"] = "@attribute", + ["@lsp.type.deriveHelper"] = "@attribute", + ["@lsp.type.enum"] = "@type", + ["@lsp.type.enumMember"] = "@constant", + ["@lsp.type.escapeSequence"] = "@string.escape", + ["@lsp.type.formatSpecifier"] = "@markup.list", + ["@lsp.type.generic"] = "@variable", + ["@lsp.type.interface"] = { fg = Util.blend_fg(c.cyan, 0.7) }, + ["@lsp.type.keyword"] = "@keyword", + ["@lsp.type.lifetime"] = "@keyword.storage", + ["@lsp.type.namespace"] = "@module", + ["@lsp.type.namespace.python"] = "@variable", + ["@lsp.type.number"] = "@number", + ["@lsp.type.operator"] = "@operator", + ["@lsp.type.parameter"] = "@variable.parameter", + ["@lsp.type.property"] = "@property", + ["@lsp.type.selfKeyword"] = "@variable.builtin", + ["@lsp.type.selfTypeKeyword"] = "@variable.builtin", + ["@lsp.type.string"] = "@string", + ["@lsp.type.typeAlias"] = "@type.definition", + ["@lsp.type.unresolvedReference"] = { undercurl = true, sp = c.error }, + ["@lsp.type.variable"] = {}, -- use treesitter styles for regular variables + ["@lsp.typemod.class.defaultLibrary"] = "@type.builtin", + ["@lsp.typemod.enum.defaultLibrary"] = "@type.builtin", + ["@lsp.typemod.enumMember.defaultLibrary"] = "@constant.builtin", + ["@lsp.typemod.function.defaultLibrary"] = "@function.builtin", + ["@lsp.typemod.keyword.async"] = "@keyword.coroutine", + ["@lsp.typemod.keyword.injected"] = "@keyword", + ["@lsp.typemod.macro.defaultLibrary"] = "@function.builtin", + ["@lsp.typemod.method.defaultLibrary"] = "@function.builtin", + ["@lsp.typemod.operator.injected"] = "@operator", + ["@lsp.typemod.string.injected"] = "@string", + ["@lsp.typemod.struct.defaultLibrary"] = "@type.builtin", + ["@lsp.typemod.type.defaultLibrary"] = { fg = Util.blend_bg(c.cyan, 0.8) }, + ["@lsp.typemod.typeAlias.defaultLibrary"] = { fg = Util.blend_bg(c.cyan, 0.8) }, + ["@lsp.typemod.variable.callable"] = "@function", + ["@lsp.typemod.variable.defaultLibrary"] = "@variable.builtin", + ["@lsp.typemod.variable.injected"] = "@variable", + ["@lsp.typemod.variable.static"] = "@constant", + } +end + +return M diff --git a/lua/eldritch/groups/snacks.lua b/lua/eldritch/groups/snacks.lua new file mode 100644 index 0000000..d4fe563 --- /dev/null +++ b/lua/eldritch/groups/snacks.lua @@ -0,0 +1,25 @@ +local Util = require("eldritch.util") + +local M = {} + +M.url = "https://github.com/folke/snacks.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + SnacksDashboardHeader = { fg = c.green }, + SnacksDashboardFooter = { fg = c.dark_cyan }, + SnacksDashboardIcon = { fg = c.cyan }, + SnacksDashboardDesc = { fg = c.cyan }, + SnacksDashboardKey = { fg = c.purple }, + SnacksDashboardTitle = { fg = c.cyan }, + SnacksNotifierInfo = { fg = c.info }, + SnacksNotifierWarn = { fg = c.warning }, + SnacksNotifierDebug = { fg = c.comment }, + SnacksNotifierError = { fg = c.error }, + SnacksNotifierTrace = { fg = c.green }, + } +end + +return M diff --git a/lua/eldritch/groups/telescope.lua b/lua/eldritch/groups/telescope.lua new file mode 100644 index 0000000..cd5b5ef --- /dev/null +++ b/lua/eldritch/groups/telescope.lua @@ -0,0 +1,26 @@ +local M = {} + +M.url = "https://github.com/nvim-telescope/telescope.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + TelescopeBorder = { fg = c.green, bg = c.bg_float }, + TelescopeNormal = { fg = c.fg, bg = c.bg_float }, + TelescopePromptBorder = { fg = c.cyan, bg = c.bg_float }, + TelescopePromptTitle = { fg = c.cyan, bg = c.bg_float }, + TelescopeResultsBorder = { fg = c.green, bg = c.bg_float }, + TelescopePreviewBorder = { fg = c.green, bg = c.bg_float }, + TelescopeSelection = { fg = c.fg, bg = c.dark5 }, + TelescopeMultiSelection = { fg = c.green, bg = c.dark5 }, + TelescopeMatching = { fg = c.pink }, + TelescopePromptPrefix = { fg = c.green }, + TelescopeResultsDiffDelete = { fg = c.red }, + TelescopeResultsDiffChange = { fg = c.cyan }, + TelescopeResultsDiffAdd = { fg = c.pink }, + TelescopeResultsComment = { fg = c.dark3 }, + } +end + +return M diff --git a/lua/eldritch/groups/treesitter-context.lua b/lua/eldritch/groups/treesitter-context.lua new file mode 100644 index 0000000..ba9e77c --- /dev/null +++ b/lua/eldritch/groups/treesitter-context.lua @@ -0,0 +1,14 @@ +local M = {} + +M.url = "https://github.com/nvim-treesitter/nvim-treesitter-context" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + local Util = require("eldritch.util") + -- stylua: ignore + return { + TreesitterContext = { bg = Util.blend_bg(c.fg_gutter, 0.8) }, + } +end + +return M diff --git a/lua/eldritch/groups/treesitter.lua b/lua/eldritch/groups/treesitter.lua new file mode 100644 index 0000000..e3185df --- /dev/null +++ b/lua/eldritch/groups/treesitter.lua @@ -0,0 +1,109 @@ +local Util = require("eldritch.util") + +local M = {} + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + local ret = { + ["@annotation"] = "PreProc", + ["@attribute"] = "PreProc", + ["@boolean"] = "Boolean", + ["@character"] = "Character", + ["@character.printf"] = "SpecialChar", + ["@character.special"] = "SpecialChar", + ["@comment"] = "Comment", + ["@comment.error"] = { fg = c.error }, + ["@comment.hint"] = { fg = c.hint }, + ["@comment.info"] = { fg = c.info }, + ["@comment.note"] = { fg = c.hint }, + ["@comment.todo"] = { fg = c.todo }, + ["@comment.warning"] = { fg = c.warning }, + ["@constant"] = "Constant", + ["@constant.builtin"] = "Special", + ["@constant.macro"] = "Define", + ["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors. + ["@constructor.tsx"] = { fg = c.cyan }, + ["@diff.delta"] = "DiffChange", + ["@diff.minus"] = "DiffDelete", + ["@diff.plus"] = "DiffAdd", + ["@function"] = "Function", + ["@function.builtin"] = "Special", + ["@function.call"] = "@function", + ["@function.macro"] = "Macro", + ["@function.method"] = "Function", + ["@function.method.call"] = "@function.method", + ["@keyword"] = { fg = c.green, style = opts.styles.keywords }, -- For keywords that don't fall in previous categories. + ["@keyword.conditional"] = "Conditional", + ["@keyword.coroutine"] = "@keyword", + ["@keyword.debug"] = "Debug", + ["@keyword.directive"] = "PreProc", + ["@keyword.directive.define"] = "Define", + ["@keyword.exception"] = "Exception", + ["@keyword.function"] = { fg = c.magenta, style = opts.styles.functions }, -- For keywords used to define a function. + ["@keyword.import"] = "Include", + ["@keyword.operator"] = "@operator", + ["@keyword.repeat"] = "Repeat", + ["@keyword.return"] = "@keyword", + ["@keyword.storage"] = "StorageClass", + ["@label"] = { fg = c.cyan }, -- For labels: `label:` in C and `:label:` in Lua. + ["@markup"] = "@none", + ["@markup.emphasis"] = { italic = true }, + ["@markup.environment"] = "Macro", + ["@markup.environment.name"] = "Type", + ["@markup.heading"] = "Title", + ["@markup.italic"] = { italic = true }, + ["@markup.link"] = { fg = c.cyan }, + ["@markup.link.label"] = "SpecialChar", + ["@markup.link.label.symbol"] = "Identifier", + ["@markup.link.url"] = "Underlined", + ["@markup.list"] = { fg = c.cyan }, -- For special punctutation that does not fall in the categories before. + ["@markup.list.checked"] = { fg = c.purple }, -- For brackets and parens. + ["@markup.list.markdown"] = { fg = c.orange, bold = true }, + ["@markup.list.unchecked"] = { fg = c.cyan }, -- For brackets and parens. + ["@markup.math"] = "Special", + ["@markup.raw"] = "String", + ["@markup.raw.markdown_inline"] = { bg = c.terminal_black, fg = c.cyan }, + ["@markup.strikethrough"] = { strikethrough = true }, + ["@markup.strong"] = { bold = true }, + ["@markup.underline"] = { underline = true }, + ["@module"] = "Include", + ["@module.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. + ["@namespace.builtin"] = "@variable.builtin", + ["@none"] = {}, + ["@number"] = "Number", + ["@number.float"] = "Float", + ["@operator"] = { fg = c.cyan }, -- For any operator: `+`, but also `->` and `*` in C. + ["@property"] = { fg = c.purple }, + ["@punctuation.bracket"] = { fg = c.fg_dark }, -- For brackets and parens. + ["@punctuation.delimiter"] = { fg = c.cyan }, -- For delimiters ie: `.` + ["@punctuation.special"] = { fg = c.cyan }, -- For special symbols (e.g. `{}` in string interpolation) + ["@punctuation.special.markdown"] = { fg = c.orange }, -- For special symbols (e.g. `{}` in string interpolation) + ["@string"] = "String", + ["@string.documentation"] = { fg = c.yellow }, + ["@string.escape"] = { fg = c.magenta }, -- For escape characters within a string. + ["@string.regexp"] = { fg = c.cyan }, -- For regexes. + ["@tag"] = "Label", + ["@tag.attribute"] = "@property", + ["@tag.delimiter"] = "Delimiter", + ["@tag.delimiter.tsx"] = { fg = Util.blend_bg(c.cyan, 0.7) }, + ["@tag.tsx"] = { fg = c.red }, + ["@tag.javascript"] = { fg = c.red }, + ["@type"] = "Type", + ["@type.builtin"] = { fg = Util.blend_bg(c.cyan, 0.8) }, + ["@type.definition"] = "Typedef", + ["@type.qualifier"] = "@keyword", + ["@variable"] = { fg = c.cyan, style = opts.styles.variables }, -- Any variable name that does not have another highlight. + ["@variable.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. + ["@variable.member"] = { fg = c.purple }, -- For fields. + ["@variable.parameter"] = { fg = c.purple }, -- For parameters of a function. + ["@variable.parameter.builtin"] = { fg = Util.blend_fg(c.purple, 0.8) }, -- For builtin parameters of a function, e.g. "..." or Smali's p[1-99] + } + + for i, color in ipairs(c.rainbow) do + ret["@markup.heading." .. i .. ".markdown"] = { fg = color, bold = true, bg = Util.blend_bg(color, 0.1) } + end + return ret +end + +return M diff --git a/lua/eldritch/groups/trouble.lua b/lua/eldritch/groups/trouble.lua new file mode 100644 index 0000000..efabd4f --- /dev/null +++ b/lua/eldritch/groups/trouble.lua @@ -0,0 +1,15 @@ +local M = {} + +M.url = "https://github.com/folke/trouble.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + TroubleText = { fg = c.fg_dark }, + TroubleCount = { fg = c.magenta, bg = c.fg_gutter }, + TroubleNormal = { fg = c.fg, bg = c.bg_float }, + } +end + +return M diff --git a/lua/eldritch/groups/which-key.lua b/lua/eldritch/groups/which-key.lua new file mode 100644 index 0000000..ddb7f41 --- /dev/null +++ b/lua/eldritch/groups/which-key.lua @@ -0,0 +1,20 @@ +local M = {} + +M.url = "https://github.com/folke/which-key.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + WhichKey = { fg = c.dark_cyan }, + WhichKeyGroup = { fg = c.cyan }, + WhichKeyDesc = { fg = c.green }, + WhichKeySeperator = { fg = c.comment }, + WhichKeySeparator = { fg = c.comment }, + WhichKeyFloat = { bg = c.bg_float }, + WhichKeyValue = { fg = c.dark5 }, + WhichKeyBorder = { fg = c.cyan }, + } +end + +return M diff --git a/lua/eldritch/groups/yanky.lua b/lua/eldritch/groups/yanky.lua new file mode 100644 index 0000000..bc724e1 --- /dev/null +++ b/lua/eldritch/groups/yanky.lua @@ -0,0 +1,14 @@ +local M = {} + +M.url = "https://github.com/gbprod/yanky.nvim" + +---@type eldritch.HighlightsFn +function M.get(c, opts) + -- stylua: ignore + return { + YankyPut = "IncSearch", + YankyYanked = "IncSearch", + } +end + +return M diff --git a/lua/eldritch/init.lua b/lua/eldritch/init.lua index b5dc714..27413f4 100644 --- a/lua/eldritch/init.lua +++ b/lua/eldritch/init.lua @@ -1,32 +1,21 @@ -local util = require("eldritch.util") -local theme = require("eldritch.theme") local config = require("eldritch.config") local M = {} ----@param arg string|table|nil -function M.load(arg) - local opts_to_pass = {} - local current_colorscheme_name = vim.g.colors_name +---@type {[string]: string} +M.styles = {} - if type(arg) == "table" then - -- If arg is a table, it's the full config options - opts_to_pass = arg - elseif type(arg) == "string" then - -- If arg is a string, it's a palette name - opts_to_pass.palette = arg - else - -- If arg is nil (i.e., eldritch colorscheme is loaded), use the palette from initial_options - opts_to_pass.palette = config.initial_options.palette or "default" +---@param opts? eldritch.Config +function M.load(opts) + opts = require("eldritch.config").extend(opts) + + -- Handle style passed as string (for backward compatibility) + if type(opts) == "string" then + opts = { style = opts } end - -- If arg is nil, opts_to_pass remains empty, and config.extend will use defaults. - - -- Always extend the configuration with a table - config.extend(opts_to_pass) - - util.load(theme.setup()) - - vim.g.colors_name = current_colorscheme_name + + M.styles[vim.o.background] = opts.style + return require("eldritch.theme").setup(opts) end M.setup = config.setup diff --git a/lua/eldritch/theme.lua b/lua/eldritch/theme.lua index 7e5128d..21d3234 100644 --- a/lua/eldritch/theme.lua +++ b/lua/eldritch/theme.lua @@ -1,955 +1,60 @@ -local util = require("eldritch.util") -local colors = require("eldritch.colors") - local M = {} --- ----@class Highlight ----@field fg string|nil ----@field bg string|nil ----@field sp string|nil ----@field style string|nil|Highlight ----@field link string|nil - ----@alias Highlights table - ----@return Theme -function M.setup() - local config = require("eldritch.config") - local options = config.options - ---@class Theme - ---@field highlights Highlights - local theme = { - config = options, - colors = colors.setup(), - } - - local is_transparent = theme.config.transparent - local bg_float_configured = is_transparent and theme.colors.none or theme.colors.bg_float - - local c = theme.colors - - theme.highlights = { - Foo = { bg = c.magenta2, fg = c.fg }, - - Comment = { fg = c.comment, style = options.styles.comments }, -- any comment - ColorColumn = { bg = c.black }, -- used for the columns set with 'colorcolumn' - Conceal = { fg = c.dark5 }, -- placeholder characters substituted for concealed text (see 'conceallevel') - Cursor = { fg = c.bg, bg = c.fg }, -- character under the cursor - lCursor = { fg = c.bg, bg = c.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') - CursorIM = { fg = c.bg, bg = c.fg }, -- like Cursor, but used when in IME mode |CursorIM| - CursorColumn = { bg = c.bg_highlight }, -- Screen-column at the cursor, when 'cursorcolumn' is set. - CursorLine = { bg = c.bg_highlight }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. - Directory = { fg = c.cyan }, -- directory names (and other special names in listings) - DiffAdd = { bg = c.diff.add }, -- diff mode: Added line |diff.txt| - DiffChange = { bg = c.diff.change }, -- diff mode: Changed line |diff.txt| - DiffDelete = { bg = c.diff.delete }, -- diff mode: Deleted line |diff.txt| - DiffText = { fg = c.fg, bg = c.magenta3 }, - EndOfBuffer = { fg = c.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - -- TermCursor = { }, -- cursor in a focused terminal - -- TermCursorNC= { }, -- cursor in an unfocused terminal - ErrorMsg = { fg = c.red }, -- error messages on the command line - VertSplit = { fg = c.purple, bold = true }, -- the column separating vertically split windows - WinSeparator = { fg = c.purple, bold = true }, -- the column separating vertically split windows - Folded = { fg = c.cyan, bg = c.fg_gutter }, -- line used for closed folds - FoldColumn = { bg = options.transparent and c.none or c.bg, fg = c.comment }, -- 'foldcolumn' - SignColumn = { bg = options.transparent and c.none or c.bg, fg = c.fg_gutter }, -- column where |signs| are displayed - SignColumnSB = { bg = c.bg_sidebar, fg = c.fg_gutter }, -- column where |signs| are displayed - Substitute = { bg = c.red, fg = c.black }, -- |:substitute| replacement text highlighting - LineNr = { fg = c.fg_gutter_light }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. - CursorLineNr = { fg = c.green }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. - MatchParen = { fg = c.orange, bold = true }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| - ModeMsg = { fg = c.fg_dark, bold = true }, -- 'showmode' message (e.g., "-- INSERT -- ") - MsgArea = { fg = c.fg_dark }, -- Area for messages and cmdline - -- MsgSeparator= { }, -- Separator for scrolled messages, `msgsep` flag of 'display' - MoreMsg = { fg = c.cyan }, -- |more-prompt| - NonText = { fg = c.dark3 }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. - Normal = { fg = c.fg, bg = options.transparent and c.none or c.bg }, -- normal text - NormalNC = { fg = c.fg, bg = options.transparent and c.none or options.dim_inactive and c.bg_dark or c.bg }, -- normal text in non-current windows - NormalSB = { fg = c.fg_sidebar, bg = c.bg_sidebar }, -- normal text in sidebar - NormalFloat = { fg = c.fg_float, bg = bg_float_configured }, -- Normal text in floating windows. - FloatBorder = { fg = c.green, bg = bg_float_configured }, - FloatTitle = { fg = c.cyan, bg = bg_float_configured }, - Pmenu = { bg = c.bg_popup, fg = c.fg }, -- Popup menu: normal item. - PmenuSel = { bg = util.darken(c.fg_gutter, 0.8) }, -- Popup menu: selected item. - PmenuSbar = { bg = util.lighten(c.bg_popup, 0.95) }, -- Popup menu: scrollbar. - PmenuThumb = { bg = c.fg_gutter }, -- Popup menu: Thumb of the scrollbar. - Question = { fg = c.cyan }, -- |hit-enter| prompt and yes/no questions - QuickFixLine = { bg = c.bg_visual, bold = true }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. - Search = { bg = c.bg_search, fg = c.fg }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. - IncSearch = { bg = c.orange, fg = c.black }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" - CurSearch = { link = "IncSearch" }, - SpecialKey = { fg = c.dark3 }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| - SpellBad = { sp = c.red, undercurl = true }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. - SpellCap = { sp = c.orange, undercurl = true }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. - SpellLocal = { sp = c.yellow, undercurl = true }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. - SpellRare = { sp = c.pink, undercurl = true }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. - StatusLine = { fg = c.fg_sidebar, bg = c.bg_statusline }, -- status line of current window - StatusLineNC = { fg = c.fg_gutter, bg = c.bg_statusline }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. - TabLine = { bg = c.bg_statusline, fg = c.fg_gutter }, -- tab pages line, not active tab page label - TabLineFill = { bg = c.black }, -- tab pages line, where there are no labels - TabLineSel = { fg = c.black, bg = c.cyan }, -- tab pages line, active tab page label - Title = { fg = c.cyan, bold = true }, -- titles for output from ":set all", ":autocmd" etc. - Visual = { bg = c.magenta3 }, -- Visual mode selection - VisualNOS = { bg = c.magenta3 }, -- Visual mode selection when vim is "Not Owning the Selection". - WarningMsg = { fg = c.orange }, -- warning messages - Whitespace = { fg = c.fg_gutter }, -- "nbsp", "space", "tab" and "trail" in 'listchars' - WildMenu = { bg = c.bg_visual }, -- current match in 'wildmenu' completion - WinBar = { link = "StatusLine" }, -- window bar - WinBarNC = { link = "StatusLineNC" }, -- window bar in inactive windows - - -- These groups are not listed as default vim groups, - -- but they are defacto standard group names for syntax highlighting. - -- commented out groups should chain up to their "preferred" group by - -- default, - -- Uncomment and edit if you want more specific syntax highlighting. - - Constant = { fg = c.red }, -- (preferred) any constant - String = { fg = c.yellow }, -- a string constant: "this is a string" - Character = { fg = c.orange }, -- a character constant: 'c', '\n' - -- Number = { }, -- a number constant: 234, 0xff - -- Boolean = { }, -- a boolean constant: TRUE, false - -- Float = { }, -- a floating point constant: 2.3e10 - - Identifier = { fg = c.magenta, style = options.styles.variables }, -- (preferred) any variable name - Function = { fg = c.pink, style = options.styles.functions }, -- function name (also: methods for classes) - - Statement = { fg = c.magenta }, -- (preferred) any statement - -- Conditional = { }, -- if, then, else, endif, switch, etc. - -- Repeat = { }, -- for, do, while, etc. - -- Label = { }, -- case, default, etc. - Operator = { fg = c.cyan }, -- "sizeof", "+", "*", etc. - Keyword = { fg = c.dark_cyan, style = options.styles.keywords }, -- any other keyword - -- Exception = { }, -- try, catch, throw - - PreProc = { fg = c.dark_cyan }, -- (preferred) generic Preprocessor - -- Include = { }, -- preprocessor #include - -- Define = { }, -- preprocessor #define - -- Macro = { }, -- same as Define - -- PreCondit = { }, -- preprocessor #if, #else, #endif, etc. - - Type = { fg = c.cyan }, -- (preferred) int, long, char, etc. - -- StorageClass = { }, -- static, register, volatile, etc. - -- Structure = { }, -- struct, union, enum, etc. - -- Typedef = { }, -- A typedef - - Special = { fg = c.cyan }, -- (preferred) any special symbol - -- SpecialChar = { }, -- special character in a constant - -- Tag = { }, -- you can use CTRL-] on this - Delimiter = { link = "Special" }, -- character that needs attention - -- SpecialComment= { }, -- special things inside a comment - Debug = { fg = c.orange }, -- debugging statements - - Underlined = { underline = true }, -- (preferred) text that stands out, HTML links - Bold = { bold = true, fg = c.fg }, -- (preferred) any bold text - Italic = { italic = true, fg = c.fg }, -- (preferred) any italic text - - -- ("Ignore", below, may be invisible...) - -- Ignore = { }, -- (preferred) left blank, hidden |hl-Ignore| - - Error = { fg = c.red }, -- (preferred) any erroneous construct - Todo = { bg = c.yellow, fg = c.bg }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX - - qfLineNr = { fg = c.dark5 }, - qfFileName = { fg = c.cyan }, - - htmlH1 = { fg = c.magenta, bold = true }, - htmlH2 = { fg = c.cyan, bold = true }, - - -- mkdHeading = { fg = c.orange, bold = true }, - -- mkdCode = { bg = c.terminal_black, fg = c.fg }, - mkdCodeDelimiter = { bg = c.terminal_black, fg = c.fg }, - mkdCodeStart = { fg = c.cyan, bold = true }, - mkdCodeEnd = { fg = c.cyan, bold = true }, - -- mkdLink = { fg = c.cyan, underline = true }, - - markdownHeadingDelimiter = { fg = c.orange, bold = true }, - markdownCode = { fg = c.cyan }, - markdownCodeBlock = { fg = c.cyan }, - markdownH1 = { fg = c.magenta, bold = true }, - markdownH2 = { fg = c.cyan, bold = true }, - markdownLinkText = { fg = c.cyan, underline = true }, - - ["helpCommand"] = { bg = c.terminal_black, fg = c.cyan }, - - debugPC = { bg = c.bg_sidebar }, -- used for highlighting the current line in terminal-debug - debugBreakpoint = { bg = util.darken(c.yellow, 0.1), fg = c.yellow }, -- used for breakpoint colors in terminal-debug - - dosIniLabel = { link = "@property" }, - - -- These groups are for the native LSP client. Some other LSP clients may - -- use these groups, or use their own. Consult your LSP client's - -- documentation. - LspReferenceText = { bg = c.fg_gutter }, -- used for highlighting "text" references - LspReferenceRead = { bg = c.fg_gutter }, -- used for highlighting "read" references - LspReferenceWrite = { bg = c.fg_gutter }, -- used for highlighting "write" references - - DiagnosticError = { fg = c.red }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default - DiagnosticWarn = { fg = c.orange }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default - DiagnosticInfo = { fg = c.yellow }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default - DiagnosticHint = { fg = c.dark_green }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default - DiagnosticUnnecessary = { fg = c.dark_green }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default - - DiagnosticVirtualTextError = { bg = util.darken(c.red, 0.1), fg = c.red }, -- Used for "Error" diagnostic virtual text - DiagnosticVirtualTextWarn = { bg = util.darken(c.orange, 0.1), fg = c.orange }, -- Used for "Warning" diagnostic virtual text - DiagnosticVirtualTextInfo = { bg = util.darken(c.yellow, 0.1), fg = c.yellow }, -- Used for "Information" diagnostic virtual text - DiagnosticVirtualTextHint = { bg = util.darken(c.dark_green, 0.1), fg = c.dark_green }, -- Used for "Hint" diagnostic virtual text - - DiagnosticUnderlineError = { undercurl = true, sp = c.red }, -- Used to underline "Error" diagnostics - DiagnosticUnderlineWarn = { undercurl = true, sp = c.orange }, -- Used to underline "Warning" diagnostics - DiagnosticUnderlineInfo = { undercurl = true, sp = c.yellow }, -- Used to underline "Information" diagnostics - DiagnosticUnderlineHint = { undercurl = true, sp = c.dark_green }, -- Used to underline "Hint" diagnostics - - LspSignatureActiveParameter = { bg = util.darken(c.bg_visual, 0.4), bold = true }, - LspCodeLens = { fg = c.comment }, - LspInlayHint = { bg = util.darken(c.cyan, 0.1), fg = c.dark3 }, - - LspInfoBorder = { fg = c.border_highlight, bg = bg_float_configured }, - - ALEErrorSign = { fg = c.red }, - ALEWarningSign = { fg = c.orange }, - - DapStoppedLine = { bg = util.darken(c.orange, 0.1) }, -- Used for "Warning" diagnostic virtual text - - -- These groups are for the Neovim tree-sitter highlights. - ["@annotation"] = { link = "PreProc" }, - ["@attribute"] = { link = "PreProc" }, - ["@boolean"] = { link = "Boolean" }, - ["@character"] = { link = "Character" }, - ["@character.special"] = { link = "SpecialChar" }, - ["@comment"] = { link = "Comment" }, - ["@keyword.conditional"] = { link = "Conditional" }, - ["@constant"] = { link = "Constant" }, - ["@constant.builtin"] = { link = "Special" }, - ["@constant.macro"] = { link = "Define" }, - ["@keyword.debug"] = { link = "Debug" }, - ["@keyword.directive.define"] = { link = "Define" }, - ["@keyword.exception"] = { link = "Exception" }, - ["@number.float"] = { link = "Float" }, - ["@function"] = { link = "Function" }, - ["@function.builtin"] = { link = "Special" }, - ["@function.call"] = { link = "@function" }, - ["@function.macro"] = { link = "Macro" }, - ["@keyword.import"] = { link = "Include" }, - ["@keyword.coroutine"] = { link = "@keyword" }, - ["@keyword.operator"] = { link = "@operator" }, - ["@keyword.return"] = { link = "@keyword" }, - ["@function.method"] = { link = "Function" }, - ["@function.method.call"] = { link = "@function.method" }, - ["@namespace.builtin"] = { link = "@variable.builtin" }, - ["@none"] = {}, - ["@number"] = { link = "Number" }, - ["@keyword.directive"] = { link = "PreProc" }, - ["@keyword.repeat"] = { link = "Repeat" }, - ["@keyword.storage"] = { link = "StorageClass" }, - ["@string"] = { link = "String" }, - ["@markup.link.label"] = { link = "SpecialChar" }, - ["@markup.link.label.symbol"] = { link = "Identifier" }, - ["@tag"] = { link = "Label" }, - ["@tag.attribute"] = { link = "@property" }, - ["@tag.delimiter"] = { link = "Delimiter" }, - ["@markup"] = { link = "@none" }, - ["@markup.environment"] = { link = "Macro" }, - ["@markup.environment.name"] = { link = "Type" }, - ["@markup.raw"] = { link = "String" }, - ["@markup.math"] = { link = "Special" }, - ["@markup.strong"] = { bold = true }, - ["@markup.emphasis"] = { italic = true }, - ["@markup.strikethrough"] = { strikethrough = true }, - ["@markup.underline"] = { underline = true }, - ["@markup.heading"] = { link = "Title" }, - ["@comment.note"] = { fg = c.pink }, - ["@comment.error"] = { fg = c.red }, - ["@comment.hint"] = { fg = c.pink }, - ["@comment.info"] = { fg = c.yellow }, - ["@comment.warning"] = { fg = c.orange }, - ["@comment.todo"] = { fg = c.todo }, - ["@markup.link.url"] = { link = "Underlined" }, - ["@type"] = { link = "Type" }, - ["@type.definition"] = { link = "Typedef" }, - ["@type.qualifier"] = { link = "@keyword" }, - - --- Misc - -- TODO: - -- ["@comment.documentation"] = { }, - ["@operator"] = { fg = c.cyan }, -- For any operator: `+`, but also `->` and `*` in C. - - --- Punctuation - ["@punctuation.delimiter"] = { fg = c.cyan }, -- For delimiters ie: `.` - ["@punctuation.bracket"] = { fg = c.fg_dark }, -- For brackets and parens. - ["@punctuation.special"] = { fg = c.cyan }, -- For special symbols (e.g. `{}` in string interpolation) - ["@markup.list"] = { fg = c.cyan }, -- For special punctutation that does not fall in the catagories before. - ["@markup.list.markdown"] = { fg = c.orange, bold = true }, - - --- Literals - ["@string.documentation"] = { fg = c.yellow }, - ["@string.html"] = { fg = c.dark_yellow }, - ["@string.regexp"] = { fg = c.cyan }, -- For regexes. - ["@string.escape"] = { fg = c.magenta }, -- For escape characters within a string. - - --- Functions - ["@constructor"] = { fg = c.magenta }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors. - ["@variable.parameter"] = { fg = c.purple }, -- For parameters of a function. - ["@variable.parameter.builtin"] = { fg = util.lighten(c.purple, 0.8) }, -- For builtin parameters of a function, e.g. "..." or Smali's p[1-99] - - --- Keywords - ["@keyword"] = { fg = c.green, style = options.styles.keywords }, -- For keywords that don't fall in previous categories. - ["@keyword.function"] = { fg = c.magenta, style = options.styles.functions }, -- For keywords used to define a fuction. - - ["@label"] = { fg = c.cyan }, -- For labels: `label:` in C and `:label:` in Lua. - - --- Types - ["@type.builtin"] = { fg = util.darken(c.cyan, 0.8) }, - ["@variable.member"] = { fg = c.purple }, -- For fields. - ["@property"] = { fg = c.purple }, - - --- Identifiers - ["@variable"] = { fg = c.cyan, style = options.styles.variables }, -- Any variable name that does not have another highlight. - ["@variable.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. - ["@module.builtin"] = { fg = c.red }, -- Variable names that are defined by the languages, like `this` or `self`. - - --- Text - -- ["@markup.raw.markdown"] = { fg = c.cyan }, - ["@markup.raw.markdown_inline"] = { bg = c.terminal_black, fg = c.cyan }, - ["@markup.link"] = { fg = c.cyan }, - - ["@markup.list.unchecked"] = { fg = c.cyan }, -- For brackets and parens. - ["@markup.list.checked"] = { fg = c.purple }, -- For brackets and parens. - - ["@diff.plus"] = { link = "DiffAdd" }, - ["@diff.minus"] = { link = "DiffDelete" }, - ["@diff.delta"] = { link = "DiffChange" }, - - ["@module"] = { link = "Include" }, - - -- tsx - ["@tag.tsx"] = { fg = c.red }, - ["@constructor.tsx"] = { fg = c.cyan }, - ["@tag.delimiter.tsx"] = { fg = util.darken(c.cyan, 0.7) }, - - -- LSP Semantic Token Groups - ["@lsp.type.boolean"] = { link = "@boolean" }, - ["@lsp.type.builtinType"] = { link = "@type.builtin" }, - ["@lsp.type.comment"] = { link = "@comment" }, - ["@lsp.type.decorator"] = { link = "@attribute" }, - ["@lsp.type.deriveHelper"] = { link = "@attribute" }, - ["@lsp.type.enum"] = { link = "@type" }, - ["@lsp.type.enumMember"] = { link = "@constant" }, - ["@lsp.type.escapeSequence"] = { link = "@string.escape" }, - ["@lsp.type.formatSpecifier"] = { link = "@markup.list" }, - ["@lsp.type.generic"] = { link = "@variable" }, - ["@lsp.type.interface"] = { fg = util.lighten(c.cyan, 0.7) }, - ["@lsp.type.keyword"] = { link = "@keyword" }, - ["@lsp.type.lifetime"] = { link = "@keyword.storage" }, - ["@lsp.type.namespace"] = { link = "@module" }, - ["@lsp.type.number"] = { link = "@number" }, - ["@lsp.type.operator"] = { link = "@operator" }, - ["@lsp.type.parameter"] = { link = "@variable.parameter" }, - ["@lsp.type.property"] = { link = "@property" }, - ["@lsp.type.selfKeyword"] = { link = "@variable.builtin" }, - ["@lsp.type.selfTypeKeyword"] = { link = "@variable.builtin" }, - ["@lsp.type.string"] = { link = "@string" }, - ["@lsp.type.typeAlias"] = { link = "@type.definition" }, - ["@lsp.type.unresolvedReference"] = { undercurl = true, sp = c.red }, - ["@lsp.type.variable"] = {}, -- use treesitter styles for regular variables - ["@lsp.typemod.class.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.enum.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.enumMember.defaultLibrary"] = { link = "@constant.builtin" }, - ["@lsp.typemod.function.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.keyword.async"] = { link = "@keyword.coroutine" }, - ["@lsp.typemod.keyword.injected"] = { link = "@keyword" }, - ["@lsp.typemod.macro.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.method.defaultLibrary"] = { link = "@function.builtin" }, - ["@lsp.typemod.operator.injected"] = { link = "@operator" }, - ["@lsp.typemod.string.injected"] = { link = "@string" }, - ["@lsp.typemod.struct.defaultLibrary"] = { link = "@type.builtin" }, - ["@lsp.typemod.type.defaultLibrary"] = { fg = util.darken(c.cyan, 0.8) }, - ["@lsp.typemod.typeAlias.defaultLibrary"] = { fg = util.darken(c.cyan, 0.8) }, - ["@lsp.typemod.variable.callable"] = { link = "@function" }, - ["@lsp.typemod.variable.defaultLibrary"] = { link = "@variable.builtin" }, - ["@lsp.typemod.variable.injected"] = { link = "@variable" }, - ["@lsp.typemod.variable.static"] = { link = "@constant" }, - -- NOTE: maybe add these with distinct highlights? - -- ["@lsp.typemod.variable.globalScope"] (global variables) - - -- Python - ["@lsp.type.namespace.python"] = { link = "@variable" }, - - -- ts-rainbow - rainbowcol1 = { fg = c.red }, - rainbowcol2 = { fg = c.yellow }, - rainbowcol3 = { fg = c.purple }, - rainbowcol4 = { fg = c.cyan }, - rainbowcol5 = { fg = c.cyan }, - rainbowcol6 = { fg = c.magenta }, - rainbowcol7 = { fg = c.green }, - - -- ts-rainbow2 (maintained fork) - TSRainbowRed = { fg = c.red }, - TSRainbowOrange = { fg = c.orange }, - TSRainbowYellow = { fg = c.yellow }, - TSRainbowGreen = { fg = c.purple }, - TSRainbowBlue = { fg = c.cyan }, - TSRainbowViolet = { fg = c.green }, - TSRainbowCyan = { fg = c.dark_cyan }, - - -- rainbow-delimiters - RainbowDelimiterRed = { fg = c.red }, - RainbowDelimiterOrange = { fg = c.orange }, - RainbowDelimiterYellow = { fg = c.yellow }, - RainbowDelimiterGreen = { fg = c.purple }, - RainbowDelimiterBlue = { fg = c.cyan }, - RainbowDelimiterViolet = { fg = c.green }, - RainbowDelimiterCyan = { fg = c.dark_cyan }, - - -- LspTrouble - TroubleText = { fg = c.fg_dark }, - TroubleCount = { fg = c.magenta, bg = c.fg_gutter }, - TroubleNormal = { fg = c.fg, bg = bg_float_configured }, - - -- Illuminate - illuminatedWord = { bg = c.fg_gutter }, - illuminatedCurWord = { bg = c.fg_gutter }, - IlluminatedWordText = { bg = c.fg_gutter }, - IlluminatedWordRead = { bg = c.fg_gutter }, - IlluminatedWordWrite = { bg = c.fg_gutter }, - - -- diff - diffAdded = { fg = c.git.add }, - diffRemoved = { fg = c.git.delete }, - diffChanged = { fg = c.git.change }, - diffOldFile = { fg = c.yellow }, - diffNewFile = { fg = c.orange }, - diffFile = { fg = c.cyan }, - diffLine = { fg = c.comment }, - diffIndexLine = { fg = c.magenta }, - - -- Diffview - DiffviewDiffText = { fg = c.fg, bg = c.magenta3 }, - - -- Neogit - NeogitBranch = { fg = c.magenta }, - NeogitRemote = { fg = c.green }, - NeogitHunkHeader = { bg = c.bg_highlight, fg = c.fg }, - NeogitHunkHeaderHighlight = { bg = c.fg_gutter, fg = c.cyan }, - NeogitDiffContextHighlight = { bg = util.darken(c.fg_gutter, 0.5), fg = c.fg_dark }, - NeogitDiffDeleteHighlight = { fg = c.git.delete, bg = c.diff.delete }, - NeogitDiffAddHighlight = { fg = c.git.add, bg = c.diff.add }, - - -- Neotest - NeotestPassed = { fg = c.purple }, - NeotestRunning = { fg = c.yellow }, - NeotestFailed = { fg = c.red }, - NeotestSkipped = { fg = c.cyan }, - NeotestTest = { fg = c.fg_sidebar }, - NeotestNamespace = { fg = c.purple }, - NeotestFocused = { fg = c.yellow }, - NeotestFile = { fg = c.cyan }, - NeotestDir = { fg = c.cyan }, - NeotestBorder = { fg = c.cyan }, - NeotestIndent = { fg = c.fg_sidebar }, - NeotestExpandMarker = { fg = c.fg_sidebar }, - NeotestAdapterName = { fg = c.green, bold = true }, - NeotestWinSelect = { fg = c.cyan }, - NeotestMarked = { fg = c.cyan }, - NeotestTarget = { fg = c.cyan }, - --[[ NeotestUnknown = {}, ]] - - -- GitGutter - GitGutterAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt| - GitGutterChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt| - GitGutterDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt| - GitGutterAddLineNr = { fg = c.gitSigns.add }, - GitGutterChangeLineNr = { fg = c.gitSigns.change }, - GitGutterDeleteLineNr = { fg = c.gitSigns.delete }, - -- GitSigns - GitSignsAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt| - GitSignsChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt| - GitSignsDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt| +---@param opts? eldritch.Config +function M.setup(opts) + opts = require("eldritch.config").extend(opts) - -- mini.diff - MiniDiffSignAdd = { fg = c.gitSigns.add }, -- diff mode: Added line |diff.txt| - MiniDiffSignChange = { fg = c.gitSigns.change }, -- diff mode: Changed line |diff.txt| - MiniDiffSignDelete = { fg = c.gitSigns.delete }, -- diff mode: Deleted line |diff.txt| + local colors = require("eldritch.colors").setup(opts) + local groups = require("eldritch.groups").setup(colors, opts) - -- Telescope - TelescopeBorder = { fg = c.green }, - TelescopePromptBorder = { fg = c.cyan }, - TelescopeResultsBorder = { fg = c.green }, - TelescopePreviewBorder = { fg = c.green }, - TelescopeSelection = { fg = c.fg, bg = c.dark5 }, - TelescopeMultiSelection = { fg = c.green, bg = c.dark5 }, - TelescopeNormal = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - TelescopeMatching = { fg = c.pink }, - TelescopePromptPrefix = { fg = c.green }, - TelescopeResultsDiffDelete = { fg = c.red }, - TelescopeResultsDiffChange = { fg = c.cyan }, - TelescopeResultsDiffAdd = { fg = c.pink }, - - -- NvimTree - NvimTreeNormal = { fg = c.fg_sidebar, bg = options.transparent and c.none or c.bg_sidebar }, - NvimTreeWinSeparator = { - fg = options.styles.sidebars == "transparent" and c.border or c.bg_sidebar, - bg = c.bg_sidebar, - }, - NvimTreeNormalNC = { fg = c.fg_sidebar, bg = options.transparent and c.none or c.bg_sidebar }, - NvimTreeRootFolder = { fg = c.cyan, bold = true }, - NvimTreeGitDirty = { fg = c.git.change }, - NvimTreeGitNew = { fg = c.git.add }, - NvimTreeGitDeleted = { fg = c.git.delete }, - NvimTreeOpenedFile = { bg = c.bg_highlight }, - NvimTreeSpecialFile = { fg = c.green, underline = true }, - NvimTreeIndentMarker = { fg = c.fg_gutter }, - NvimTreeImageFile = { fg = c.fg_sidebar }, - NvimTreeSymlink = { fg = c.cyan }, - NvimTreeFolderIcon = { bg = c.none, fg = c.cyan }, - - NeoTreeNormal = { fg = c.fg_sidebar, bg = options.transparent and c.none or c.bg_sidebar }, - NeoTreeNormalNC = { fg = c.fg_sidebar, bg = options.transparent and c.none or c.bg_sidebar }, - NeoTreeDimText = { fg = c.fg_gutter }, - NeoTreeTitleBar = { link = "NeoTreeNormalNC" }, - NeoTreeFloatBorder = { link = "NeoTreeNormalNC" }, - - -- Fern - FernBranchText = { fg = c.cyan }, - - -- glyph palette - GlyphPalette1 = { fg = c.red }, - GlyphPalette2 = { fg = c.purple }, - GlyphPalette3 = { fg = c.yellow }, - GlyphPalette4 = { fg = c.cyan }, - GlyphPalette6 = { fg = c.purple }, - GlyphPalette7 = { fg = c.fg }, - GlyphPalette9 = { fg = c.red }, - - -- Dashboard - DashboardShortCut = { fg = c.dark_cyan }, - DashboardHeader = { fg = c.green }, - DashboardCenter = { fg = c.magenta }, - DashboardFooter = { fg = c.dark_cyan }, - DashboardKey = { fg = c.purple }, - DashboardDesc = { fg = c.cyan }, - DashboardIcon = { fg = c.green, bold = true }, - - -- Alpha - AlphaShortcut = { fg = c.orange }, - AlphaHeader = { fg = c.cyan }, - AlphaHeaderLabel = { fg = c.orange }, - AlphaFooter = { fg = c.cyan }, - AlphaButtons = { fg = c.dark_cyan }, - - -- WhichKey - WhichKey = { fg = c.dark_cyan }, - WhichKeyGroup = { fg = c.cyan }, - WhichKeyDesc = { fg = c.green }, - WhichKeySeperator = { fg = c.comment }, - WhichKeySeparator = { fg = c.comment }, - WhichKeyFloat = { bg = bg_float_configured }, - WhichKeyValue = { fg = c.dark5 }, - WhichKeyBorder = { fg = c.cyan }, - - -- LspSaga - DiagnosticWarning = { link = "DiagnosticWarn" }, - DiagnosticInformation = { link = "DiagnosticInfo" }, - - LspFloatWinNormal = { fg = colors.fg, bg = bg_float_configured }, - LspFloatWinBorder = { fg = colors.green }, - LspSagaHoverBorder = { fg = colors.green }, - LspSagaSignatureHelpBorder = { fg = colors.green }, - LspSagaCodeActionBorder = { fg = colors.green }, - LspSagaDefPreviewBorder = { fg = colors.green }, - LspLinesDiagBorder = { fg = colors.green }, - LspSagaRenameBorder = { fg = colors.green }, - LspSagaBorderTitle = { fg = colors.cyan }, - LSPSagaDiagnosticTruncateLine = { fg = colors.comment }, - LspSagaDiagnosticBorder = { fg = colors.green }, - LspSagaShTruncateLine = { fg = colors.comment }, - LspSagaDocTruncateLine = { fg = colors.comment }, - LspSagaLspFinderBorder = { fg = colors.green }, - CodeActionNumber = { bg = "NONE", fg = colors.cyan }, - ReferencesCount = { fg = c.green }, - DefinitionCount = { fg = c.green }, - DefinitionIcon = { fg = c.cyan }, - ReferencesIcon = { fg = c.cyan }, - TargetWord = { fg = c.dark_cyan }, - - -- NeoVim - healthError = { fg = c.red }, - healthSuccess = { fg = c.purple }, - healthWarning = { fg = c.orange }, - - -- BufferLine - BufferLineIndicatorSelected = { fg = c.git.change }, - - -- Barbar - BufferCurrent = { bg = c.bg, fg = c.fg }, - BufferCurrentERROR = { bg = c.bg, fg = c.red }, - BufferCurrentHINT = { bg = c.bg, fg = c.pink }, - -- BufferCurrentIcon = { bg = c.bg, fg = c.}, - BufferCurrentINFO = { bg = c.bg, fg = c.yellow }, - BufferCurrentWARN = { bg = c.bg, fg = c.orange }, - BufferCurrentIndex = { bg = c.bg, fg = c.yellow }, - BufferCurrentMod = { bg = c.bg, fg = c.orange }, - BufferCurrentSign = { bg = c.bg, fg = c.bg }, - BufferCurrentTarget = { bg = c.bg, fg = c.red }, - BufferAlternate = { bg = c.fg_gutter, fg = c.fg }, - BufferAlternateERROR = { bg = c.fg_gutter, fg = c.red }, - BufferAlternateHINT = { bg = c.fg_gutter, fg = c.pink }, - -- BufferAlternateIcon = { bg = c.fg_gutter, fg = c. }, - BufferAlternateIndex = { bg = c.fg_gutter, fg = c.yellow }, - BufferAlternateINFO = { bg = c.fg_gutter, fg = c.yellow }, - BufferAlternateMod = { bg = c.fg_gutter, fg = c.orange }, - BufferAlternateSign = { bg = c.fg_gutter, fg = c.yellow }, - BufferAlternateTarget = { bg = c.fg_gutter, fg = c.red }, - BufferAlternateWARN = { bg = c.fg_gutter, fg = c.orange }, - BufferVisible = { bg = c.bg_statusline, fg = c.fg }, - BufferVisibleERROR = { bg = c.bg_statusline, fg = c.red }, - BufferVisibleHINT = { bg = c.bg_statusline, fg = c.pink }, - -- BufferVisibleIcon = { bg = c.bg_statusline, fg = c. }, - BufferVisibleINFO = { bg = c.bg_statusline, fg = c.yellow }, - BufferVisibleWARN = { bg = c.bg_statusline, fg = c.orange }, - BufferVisibleIndex = { bg = c.bg_statusline, fg = c.yellow }, - BufferVisibleMod = { bg = c.bg_statusline, fg = c.orange }, - BufferVisibleSign = { bg = c.bg_statusline, fg = c.yellow }, - BufferVisibleTarget = { bg = c.bg_statusline, fg = c.red }, - BufferInactive = { bg = util.darken(c.bg_highlight, 0.4), fg = util.darken(c.dark5, 0.8) }, - BufferInactiveERROR = { bg = util.darken(c.bg_highlight, 0.4), fg = util.darken(c.red, 0.8) }, - BufferInactiveHINT = { bg = util.darken(c.bg_highlight, 0.4), fg = util.darken(c.pink, 0.8) }, - -- BufferInactiveIcon = { bg = c.bg_statusline, fg = util.darken(c., 0.1) }, - BufferInactiveINFO = { bg = util.darken(c.bg_highlight, 0.4), fg = util.darken(c.yellow, 0.8) }, - BufferInactiveWARN = { bg = util.darken(c.bg_highlight, 0.4), fg = util.darken(c.orange, 0.8) }, - BufferInactiveIndex = { bg = util.darken(c.bg_highlight, 0.4), fg = c.dark5 }, - BufferInactiveMod = { bg = util.darken(c.bg_highlight, 0.4), fg = util.darken(c.orange, 0.8) }, - BufferInactiveSign = { bg = util.darken(c.bg_highlight, 0.4), fg = c.bg }, - BufferInactiveTarget = { bg = util.darken(c.bg_highlight, 0.4), fg = c.red }, - BufferOffset = { bg = c.bg_statusline, fg = c.dark5 }, - BufferTabpageFill = { bg = util.darken(c.bg_highlight, 0.8), fg = c.dark5 }, - BufferTabpages = { bg = c.bg_statusline, fg = c.none }, - - -- Sneak - Sneak = { fg = c.bg_highlight, bg = c.magenta }, - SneakScope = { bg = c.bg_visual }, - - -- Hop - HopNextKey = { fg = c.magenta2, bold = true }, - HopNextKey1 = { fg = c.cyan, bold = true }, - HopNextKey2 = { fg = util.darken(c.cyan, 0.6) }, - HopUnmatched = { fg = c.dark3 }, - - TSNodeKey = { fg = c.magenta2, bold = true }, - TSNodeUnmatched = { fg = c.dark3 }, - - LeapMatch = { bg = c.magenta2, fg = c.fg, bold = true }, - LeapLabelPrimary = { fg = c.magenta2, bold = true }, - LeapLabelSecondary = { fg = c.purple, bold = true }, - LeapBackdrop = { fg = c.dark3 }, - - FlashBackdrop = { fg = c.dark3 }, - FlashLabel = { bg = c.green, bold = true, fg = c.black }, - FlashCurrent = { bg = c.bg_highlight, bold = true, fg = c.purple }, - FlashMatch = { bg = c.bg_highlight, bold = true, fg = c.pink }, - - LightspeedGreyWash = { fg = c.dark3 }, - -- LightspeedCursor = { link = "Cursor" }, - LightspeedLabel = { fg = c.magenta2, bold = true, underline = true }, - LightspeedLabelDistant = { fg = c.purple, bold = true, underline = true }, - LightspeedLabelDistantOverlapped = { fg = c.purple, underline = true }, - LightspeedLabelOverlapped = { fg = c.magenta2, underline = true }, - LightspeedMaskedChar = { fg = c.orange }, - LightspeedOneCharMatch = { bg = c.magenta2, fg = c.fg, bold = true }, - LightspeedPendingOpArea = { bg = c.magenta2, fg = c.fg }, - LightspeedShortcut = { bg = c.magenta2, fg = c.fg, bold = true, underline = true }, - -- LightspeedShortcutOverlapped = { link = "LightspeedShortcut" }, - -- LightspeedUniqueChar = { link = "LightspeedUnlabeledMatch" }, - LightspeedUnlabeledMatch = { fg = c.cyan, bold = true }, - - -- Cmp - CmpDocumentation = { fg = c.fg, bg = bg_float_configured }, - CmpDocumentationBorder = { fg = c.border_highlight, bg = bg_float_configured }, - CmpGhostText = { fg = c.terminal_black }, - - CmpItemAbbr = { fg = c.fg, bg = c.none }, - CmpItemAbbrDeprecated = { fg = c.fg_gutter, bg = c.none, strikethrough = true }, - CmpItemAbbrMatch = { fg = c.cyan, bg = c.none }, - CmpItemAbbrMatchFuzzy = { fg = c.cyan, bg = c.none }, - - CmpItemMenu = { fg = c.comment, bg = c.none }, - - CmpItemKindDefault = { fg = c.fg_dark, bg = c.none }, - - CmpItemKindCodeium = { fg = c.cyan, bg = c.none }, - CmpItemKindCopilot = { fg = c.cyan, bg = c.none }, - CmpItemKindTabNine = { fg = c.cyan, bg = c.none }, - - -- blink.nvim - BlinkCmpDoc = { fg = c.fg, bg = c.bg_highlight }, - BlinkCmpDocBorder = { fg = c.green, bg = c.bg_float }, - BlinkCmpGhostText = { fg = c.fg_gutter_light }, - BlinkCmpKind = { fg = c.cyan, bg = c.none }, - BlinkCmpLabel = { fg = c.fg, bg = c.none }, - BlinkCmpLabelDeprecated = { fg = c.fg_gutter, bg = c.none, strikethrough = true }, - BlinkCmpLabelMatch = { fg = c.bright_cyan, bg = c.none }, - BlinkCmpMenu = { fg = c.fg, bg = c.bg_highlight }, - BlinkCmpMenuBorder = { fg = c.green, bg = c.bg }, - BlinkCmpScrollBarThumb = { fg = c.bg_highlight, bg = c.cyan }, - - -- fzf-lua - FzfLuaNormal = { fg = c.fg, bg = bg_float_configured }, - FzfLuaBorder = { fg = c.green, bg = bg_float_configured }, - FzfLuaSearch = { fg = c.fg, bg = bg_float_configured }, - FzfLuaTitle = { fg = c.cyan, bg = bg_float_configured }, - FzfLuaCursorLine = { bg = c.bg_highlight, fg = c.green }, - FzfLuaFzfPrompt = { bg = bg_float_configured, fg = c.purple }, - - -- headlines.nvim - CodeBlock = { bg = c.bg_highlight }, - - -- navic - NavicSeparator = { fg = c.fg, bg = c.none }, - NavicText = { fg = c.fg, bg = c.none }, - - AerialNormal = { fg = c.fg, bg = c.none }, - AerialGuide = { fg = c.fg_gutter }, - AerialLine = { link = "LspInlayHint" }, - - IndentBlanklineChar = { fg = c.fg_gutter, nocombine = true }, - IndentBlanklineContextChar = { fg = c.green, nocombine = true }, - IndentBlankLineScopeParent = { fg = c.fg, bg = c.magenta3 }, - IblIndent = { fg = c.fg_gutter, nocombine = true }, - IblScope = { fg = c.green, nocombine = true }, - - -- Scrollbar - ScrollbarHandle = { fg = c.none, bg = c.bg_highlight }, - - ScrollbarSearchHandle = { fg = c.orange, bg = c.bg_highlight }, - ScrollbarSearch = { fg = c.orange, bg = c.none }, - - ScrollbarErrorHandle = { fg = c.red, bg = c.bg_highlight }, - ScrollbarError = { fg = c.red, bg = c.none }, - - ScrollbarWarnHandle = { fg = c.orange, bg = c.bg_highlight }, - ScrollbarWarn = { fg = c.orange, bg = c.none }, - - ScrollbarInfoHandle = { fg = c.yellow, bg = c.bg_highlight }, - ScrollbarInfo = { fg = c.yellow, bg = c.none }, - - ScrollbarHintHandle = { fg = c.pink, bg = c.bg_highlight }, - ScrollbarHint = { fg = c.pink, bg = c.none }, - - ScrollbarMiscHandle = { fg = c.green, bg = c.bg_highlight }, - ScrollbarMisc = { fg = c.green, bg = c.none }, - - -- Yanky - YankyPut = { link = "IncSearch" }, - YankyYanked = { link = "IncSearch" }, - - -- Lazy - LazyProgressDone = { bold = true, fg = c.magenta2 }, - LazyProgressTodo = { bold = true, fg = c.fg_gutter }, - - -- Notify - NotifyBackground = { fg = c.fg, bg = bg_float_configured }, - --- Border - NotifyERRORBorder = { fg = util.darken(c.red, 0.3), bg = options.transparent and c.none or c.bg }, - NotifyWARNBorder = { fg = util.darken(c.orange, 0.3), bg = options.transparent and c.none or c.bg }, - NotifyINFOBorder = { fg = util.darken(c.yellow, 0.3), bg = options.transparent and c.none or c.bg }, - NotifyDEBUGBorder = { fg = util.darken(c.comment, 0.3), bg = options.transparent and c.none or c.bg }, - NotifyTRACEBorder = { fg = util.darken(c.green, 0.3), bg = options.transparent and c.none or c.bg }, - --- Icons - NotifyERRORIcon = { fg = c.red }, - NotifyWARNIcon = { fg = c.orange }, - NotifyINFOIcon = { fg = c.yellow }, - NotifyDEBUGIcon = { fg = c.comment }, - NotifyTRACEIcon = { fg = c.green }, - --- Title - NotifyERRORTitle = { fg = c.red }, - NotifyWARNTitle = { fg = c.orange }, - NotifyINFOTitle = { fg = c.yellow }, - NotifyDEBUGTitle = { fg = c.comment }, - NotifyTRACETitle = { fg = c.green }, - --- Body - NotifyERRORBody = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - NotifyWARNBody = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - NotifyINFOBody = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - NotifyDEBUGBody = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - NotifyTRACEBody = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - - -- Mini - MiniCompletionActiveParameter = { underline = true }, - - MiniCursorword = { bg = c.fg_gutter }, - MiniCursorwordCurrent = { bg = c.fg_gutter }, - - MiniIndentscopeSymbol = { fg = c.cyan, nocombine = true }, - MiniIndentscopePrefix = { nocombine = true }, -- Make it invisible - - MiniJump = { bg = c.magenta2, fg = "#ffffff" }, - - MiniJump2dSpot = { fg = c.magenta2, bold = true, nocombine = true }, - - MiniStarterCurrent = { nocombine = true }, - MiniStarterFooter = { fg = c.yellow, italic = true }, - MiniStarterHeader = { fg = c.cyan }, - MiniStarterInactive = { fg = c.comment, style = options.styles.comments }, - MiniStarterItem = { fg = c.fg, bg = options.transparent and c.none or c.bg }, - MiniStarterItemBullet = { fg = c.border_highlight }, - MiniStarterItemPrefix = { fg = c.orange }, - MiniStarterSection = { fg = c.cyan }, - MiniStarterQuery = { fg = c.yellow }, - - MiniStatuslineDevinfo = { fg = c.fg_dark, bg = c.bg_highlight }, - MiniStatuslineFileinfo = { fg = c.fg_dark, bg = c.bg_highlight }, - MiniStatuslineFilename = { fg = c.fg_dark, bg = c.fg_gutter }, - MiniStatuslineInactive = { fg = c.cyan, bg = c.bg_statusline }, - MiniStatuslineModeCommand = { fg = c.black, bg = c.yellow, bold = true }, - MiniStatuslineModeInsert = { fg = c.black, bg = c.purple, bold = true }, - MiniStatuslineModeNormal = { fg = c.black, bg = c.cyan, bold = true }, - MiniStatuslineModeOther = { fg = c.black, bg = c.cyan, bold = true }, - MiniStatuslineModeReplace = { fg = c.black, bg = c.red, bold = true }, - MiniStatuslineModeVisual = { fg = c.black, bg = c.magenta, bold = true }, - - MiniSurround = { bg = c.orange, fg = c.black }, - - MiniTablineCurrent = { fg = c.fg, bg = c.fg_gutter }, - MiniTablineFill = { bg = c.black }, - MiniTablineHidden = { fg = c.dark5, bg = c.bg_statusline }, - MiniTablineModifiedCurrent = { fg = c.orange, bg = c.fg_gutter }, - MiniTablineModifiedHidden = { bg = c.bg_statusline, fg = util.darken(c.orange, 0.7) }, - MiniTablineModifiedVisible = { fg = c.orange, bg = c.bg_statusline }, - MiniTablineTabpagesection = { bg = c.bg_statusline, fg = c.none }, - MiniTablineVisible = { fg = c.fg, bg = c.bg_statusline }, - - MiniTestEmphasis = { bold = true }, - MiniTestFail = { fg = c.red, bold = true }, - MiniTestPass = { fg = c.purple, bold = true }, - - MiniTrailspace = { bg = c.red }, - - -- Noice - NoiceCompletionItemKindDefault = { fg = c.fg_dark, bg = c.none }, - -- Default - NoiceCmdline = { fg = c.green, bg = bg_float_configured }, - NoiceCmdlineIcon = { fg = c.green, bg = bg_float_configured }, - NoiceCmdlinePopupBorder = { fg = c.green, bg = bg_float_configured }, - NoiceCmdlinePopupTitle = { fg = c.green, bg = bg_float_configured }, - -- Filter (shell command) - NoiceCmdlinePopupBorderFilter = { fg = c.pink, bg = bg_float_configured }, - NoiceCmdlineIconFilter = { fg = c.pink, bg = bg_float_configured }, - -- Lua - NoiceCmdlinePopupBorderLua = { fg = c.dark_cyan }, - NoiceCmdlineIconLua = { fg = c.dark_cyan }, - -- Help - NoiceCmdlinePopupBorderHelp = { fg = c.yellow }, - NoiceCmdlineIconHelp = { fg = c.yellow }, - -- LspProgress - NoiceLspProgressSpinner = { fg = c.cyan }, - NoiceLspProgressTitle = { fg = c.green }, - NoiceLspProgressClient = { fg = c.purple }, - NoiceMini = { bg = c.bg_highlight }, - - TreesitterContext = { bg = util.darken(c.fg_gutter, 0.8) }, - Hlargs = { fg = c.yellow }, - -- TreesitterContext = { bg = util.darken(c.bg_visual, 0.4) }, - } - - -- lsp symbol kind and completion kind highlights - local kinds = { - Array = "@punctuation.bracket", - Boolean = "@boolean", - Class = "@type", - Color = "Special", - Constant = "@constant", - Constructor = "@constructor", - Enum = "@lsp.type.enum", - EnumMember = "@lsp.type.enumMember", - Event = "Special", - Field = "@variable.member", - File = "Normal", - Folder = "Directory", - Function = "@function", - Interface = "@lsp.type.interface", - Key = "@variable.member", - Keyword = "@lsp.type.keyword", - Method = "@function.method", - Module = "@module", - Namespace = "@module", - Null = "@constant.builtin", - Number = "@number", - Object = "@constant", - Operator = "@operator", - Package = "@module", - Property = "@property", - Reference = "@markup.link", - Snippet = "Conceal", - String = "@string", - Struct = "@lsp.type.struct", - Unit = "@lsp.type.struct", - Text = "@markup", - TypeParameter = "@lsp.type.typeParameter", - Variable = "@variable", - Value = "@string", - } - - local kind_groups = { "NavicIcons%s", "Aerial%sIcon", "CmpItemKind%s", "NoiceCompletionItemKind%s" } - for kind, link in pairs(kinds) do - local base = "LspKind" .. kind - theme.highlights[base] = { link = link } - for _, plugin in pairs(kind_groups) do - theme.highlights[plugin:format(kind)] = { link = base } - end + -- only needed to clear when not the default colorscheme + if vim.g.colors_name then + vim.cmd("hi clear") end - local markdown_rainbow = { c.cyan, c.yellow, c.purple, c.cyan, c.magenta, c.green } + vim.o.termguicolors = true + vim.g.colors_name = "eldritch-" .. opts.style - for i, color in ipairs(markdown_rainbow) do - theme.highlights["@markup.heading." .. i .. ".markdown"] = { fg = color, bold = true } - theme.highlights["Headline" .. i] = { bg = util.darken(color, 0.05) } + for group, hl in pairs(groups) do + hl = type(hl) == "string" and { link = hl } or hl + vim.api.nvim_set_hl(0, group, hl) end - theme.highlights["Headline"] = { link = "Headline1" } - if not vim.diagnostic then - local severity_map = { - Error = "Error", - Warn = "Warning", - Info = "Information", - Hint = "Hint", - } - local types = { "Default", "VirtualText", "Underline" } - for _, type in ipairs(types) do - for snew, sold in pairs(severity_map) do - theme.highlights["LspDiagnostics" .. type .. sold] = { - link = "Diagnostic" .. (type == "Default" and "" or type) .. snew, - } - end - end + if opts.terminal_colors then + M.terminal(colors) end - ---@type table - theme.defer = {} + return colors, groups, opts +end - if options.hide_inactive_statusline then - local inactive = { underline = true, bg = c.none, fg = c.bg, sp = c.border } +---@param colors ColorScheme +function M.terminal(colors) + -- dark + vim.g.terminal_color_0 = colors.terminal.black + vim.g.terminal_color_8 = colors.terminal.black_bright - -- StatusLineNC - theme.highlights.StatusLineNC = inactive + -- light + vim.g.terminal_color_7 = colors.terminal.white + vim.g.terminal_color_15 = colors.terminal.white_bright - -- LuaLine - for _, section in ipairs({ "a", "b", "c" }) do - theme.defer["lualine_" .. section .. "_inactive"] = inactive - end + -- colors + vim.g.terminal_color_1 = colors.terminal.red + vim.g.terminal_color_9 = colors.terminal.red_bright - -- mini.statusline - theme.highlights.MiniStatuslineInactive = inactive - end + vim.g.terminal_color_2 = colors.terminal.green + vim.g.terminal_color_10 = colors.terminal.green_bright - options.on_highlights(theme.highlights, theme.colors) + vim.g.terminal_color_3 = colors.terminal.yellow + vim.g.terminal_color_11 = colors.terminal.yellow_bright - -- Use #000000 for full transparency - if options.transparent then - theme.highlights.NotifyBackground = { bg = "#000000" } - end + vim.g.terminal_color_4 = colors.terminal.blue + vim.g.terminal_color_12 = colors.terminal.blue_bright + + vim.g.terminal_color_5 = colors.terminal.magenta + vim.g.terminal_color_13 = colors.terminal.magenta_bright - return theme + vim.g.terminal_color_6 = colors.terminal.cyan + vim.g.terminal_color_14 = colors.terminal.cyan_bright end return M diff --git a/lua/eldritch/types.lua b/lua/eldritch/types.lua new file mode 100644 index 0000000..1ebda6c --- /dev/null +++ b/lua/eldritch/types.lua @@ -0,0 +1,10 @@ +---@class eldritch.Highlight: vim.api.keyset.highlight +---@field style? vim.api.keyset.highlight + +---@alias eldritch.Highlights table + +---@alias eldritch.HighlightsFn fun(colors: ColorScheme, opts:eldritch.Config):eldritch.Highlights + +---@class eldritch.Cache +---@field groups eldritch.Highlights +---@field inputs table diff --git a/lua/eldritch/util.lua b/lua/eldritch/util.lua index fb61268..97b65fb 100644 --- a/lua/eldritch/util.lua +++ b/lua/eldritch/util.lua @@ -2,20 +2,35 @@ local M = {} M.bg = "#000000" M.fg = "#ffffff" +M.day_brightness = 0.3 + +local uv = vim.uv or vim.loop ---@param c string -local function hexToRgb(c) +local function rgb(c) c = string.lower(c) return { tonumber(c:sub(2, 3), 16), tonumber(c:sub(4, 5), 16), tonumber(c:sub(6, 7), 16) } end +local me = debug.getinfo(1, "S").source:sub(2) +me = vim.fn.fnamemodify(me, ":h:h") + +function M.mod(modname) + if package.loaded[modname] then + return package.loaded[modname] + end + local ret = loadfile(me .. "/" .. modname:gsub("%.", "/") .. ".lua")() + package.loaded[modname] = ret + return ret +end + ---@param foreground string foreground color ----@param background string background color ---@param alpha number|string number between 0 and 1. 0 results in bg, 1 results in fg -function M.blend(foreground, background, alpha) +---@param background string background color +function M.blend(foreground, alpha, background) alpha = type(alpha) == "string" and (tonumber(alpha, 16) / 0xff) or alpha - local bg = hexToRgb(background) - local fg = hexToRgb(foreground) + local bg = rgb(background) + local fg = rgb(foreground) local blendChannel = function(i) local ret = (alpha * fg[i] + ((1 - alpha) * bg[i])) @@ -25,74 +40,69 @@ function M.blend(foreground, background, alpha) return string.format("#%02x%02x%02x", blendChannel(1), blendChannel(2), blendChannel(3)) end -function M.darken(hex, amount, bg) - return M.blend(hex, bg or M.bg, amount) +function M.blend_bg(hex, amount, bg) + return M.blend(hex, amount, bg or M.bg) end +M.darken = M.blend_bg -function M.lighten(hex, amount, fg) - return M.blend(hex, fg or M.fg, amount) +function M.blend_fg(hex, amount, fg) + return M.blend(hex, amount, fg or M.fg) end +M.lighten = M.blend_fg -function M.invert_color(color) - local hsluv = require("eldritch.hsluv") - if color ~= "NONE" then - local hsl = hsluv.hex_to_hsluv(color) - hsl[3] = 100 - hsl[3] - if hsl[3] < 40 then - hsl[3] = hsl[3] + (100 - hsl[3]) * M.day_brightness +---@param color string|Palette +function M.invert(color) + if type(color) == "table" then + for key, value in pairs(color) do + color[key] = M.invert(value) end - return hsluv.hsluv_to_hex(hsl) - end - return color -end - ----@param group string -function M.highlight(group, hl) - if hl.style then - if type(hl.style) == "table" then - hl = vim.tbl_extend("force", hl, hl.style) - elseif hl.style:lower() ~= "none" then - -- handle old string style definitions - for s in string.gmatch(hl.style, "([^,]+)") do - hl[s] = true + elseif type(color) == "string" then + local hsluv = require("eldritch.hsluv") + if color ~= "NONE" then + local hsl = hsluv.hex_to_hsluv(color) + hsl[3] = 100 - hsl[3] + if hsl[3] < 40 then + hsl[3] = hsl[3] + (100 - hsl[3]) * M.day_brightness end + return hsluv.hsluv_to_hex(hsl) end - hl.style = nil end - vim.api.nvim_set_hl(0, group, hl) + return color end ----@param config Config -function M.autocmds(config) - local group = vim.api.nvim_create_augroup("eldritch", { clear = true }) - - vim.api.nvim_create_autocmd("ColorSchemePre", { - group = group, - callback = function() - vim.api.nvim_del_augroup_by_id(group) - end, - }) - local function set_whl() - local win = vim.api.nvim_get_current_win() - local whl = vim.split(vim.wo[win].winhighlight, ",") - vim.list_extend(whl, { "Normal:NormalSB", "SignColumn:SignColumnSB" }) - whl = vim.tbl_filter(function(hl) - return hl ~= "" - end, whl) - vim.opt_local.winhighlight = table.concat(whl, ",") - end +---@param color string -- The hex color string to be adjusted +---@param lightness_amount number? -- The amount to increase lightness by (optional, default: 0.05) +---@param saturation_amount number? -- The amount to increase saturation by (optional, default: 0.2) +function M.brighten(color, lightness_amount, saturation_amount) + lightness_amount = lightness_amount or 0.05 + saturation_amount = saturation_amount or 0.2 + local hsluv = require("eldritch.hsluv") + + -- Convert the hex color to HSLuv + local hsl = hsluv.hex_to_hsluv(color) - vim.api.nvim_create_autocmd("FileType", { - group = group, - pattern = table.concat(config.sidebars, ","), - callback = set_whl, - }) - if vim.tbl_contains(config.sidebars, "terminal") then - vim.api.nvim_create_autocmd("TermOpen", { - group = group, - callback = set_whl, - }) + -- Increase lightness slightly + hsl[3] = math.min(hsl[3] + (lightness_amount * 100), 100) + + -- Increase saturation a bit more to make the color more vivid + hsl[2] = math.min(hsl[2] + (saturation_amount * 100), 100) + + -- Convert the HSLuv back to hex and return + return hsluv.hsluv_to_hex(hsl) +end + +---@param groups eldritch.Highlights +---@return table +function M.resolve(groups) + for _, hl in pairs(groups) do + if type(hl) == "table" and type(hl.style) == "table" then + for k, v in pairs(hl.style) do + hl[k] = v + end + hl.style = nil + end end + return groups end -- Simple string interpolation. @@ -109,90 +119,52 @@ function M.template(str, table) ) end -function M.syntax(syntax) - for group, colors in pairs(syntax) do - M.highlight(group, colors) - end +---@param file string +function M.read(file) + local fd = assert(io.open(file, "r")) + ---@type string + local data = fd:read("*a") + fd:close() + return data end ----@param colors ColorScheme -function M.terminal(colors) - -- dark - vim.g.terminal_color_0 = colors.black - vim.g.terminal_color_8 = colors.terminal_black - - -- light - vim.g.terminal_color_7 = colors.fg_dark - vim.g.terminal_color_15 = colors.fg - - -- colors - vim.g.terminal_color_1 = colors.red - vim.g.terminal_color_9 = colors.red - - vim.g.terminal_color_2 = colors.green - vim.g.terminal_color_10 = colors.green - - vim.g.terminal_color_3 = colors.yellow - vim.g.terminal_color_11 = colors.yellow - - vim.g.terminal_color_4 = colors.dark_cyan - vim.g.terminal_color_12 = colors.dark_cyan +---@param file string +---@param contents string +function M.write(file, contents) + vim.fn.mkdir(vim.fn.fnamemodify(file, ":h"), "p") + local fd = assert(io.open(file, "w+")) + fd:write(contents) + fd:close() +end - vim.g.terminal_color_5 = colors.magenta - vim.g.terminal_color_13 = colors.magenta +M.cache = {} - vim.g.terminal_color_6 = colors.cyan - vim.g.terminal_color_14 = colors.cyan +function M.cache.file(key) + return vim.fn.stdpath("cache") .. "/eldritch-" .. key .. ".json" end ----@param colors ColorScheme -function M.invert_colors(colors) - if type(colors) == "string" then - ---@diagnostic disable-next-line: return-type-mismatch - return M.invert_color(colors) - end - for key, value in pairs(colors) do - colors[key] = M.invert_colors(value) - end - return colors +---@param key string +function M.cache.read(key) + ---@type boolean, eldritch.Cache + local ok, ret = pcall(function() + return vim.json.decode(M.read(M.cache.file(key)), { luanil = { + object = true, + array = true, + } }) + end) + return ok and ret or nil end ----@param hls Highlights -function M.invert_highlights(hls) - for _, hl in pairs(hls) do - if hl.fg then - hl.fg = M.invert_color(hl.fg) - end - if hl.bg then - hl.bg = M.invert_color(hl.bg) - end - if hl.sp then - hl.sp = M.invert_color(hl.sp) - end - end +---@param key string +---@param data eldritch.Cache +function M.cache.write(key, data) + pcall(M.write, M.cache.file(key), vim.json.encode(data)) end ----@param theme Theme -function M.load(theme) - -- only needed to clear when not the default colorscheme - if vim.g.colors_name then - vim.cmd("hi clear") - end - - vim.o.termguicolors = true - - M.syntax(theme.highlights) - - -- vim.api.nvim_set_hl_ns(M.ns) - if theme.config.terminal_colors then - M.terminal(theme.colors) +function M.cache.clear() + for _, style in ipairs({ "default", "darker", "minimal" }) do + uv.fs_unlink(M.cache.file(style)) end - - M.autocmds(theme.config) - - vim.defer_fn(function() - M.syntax(theme.defer) - end, 100) end return M diff --git a/lua/lualine/themes/_eldritch.lua b/lua/lualine/themes/_eldritch.lua new file mode 100644 index 0000000..76124f7 --- /dev/null +++ b/lua/lualine/themes/_eldritch.lua @@ -0,0 +1,56 @@ +local M = {} + +---@param style? string +function M.get(style) + local colors, config = require("eldritch.colors").setup({ + style = style, + }) + + local hl = {} + + hl.normal = { + a = { bg = colors.cyan, fg = colors.black }, + b = { bg = colors.fg_gutter, fg = colors.cyan }, + c = { bg = colors.bg_statusline, fg = colors.fg_sidebar }, + } + + hl.insert = { + a = { bg = colors.green, fg = colors.black }, + b = { bg = colors.fg_gutter, fg = colors.green }, + } + + hl.command = { + a = { bg = colors.pink or colors.magenta, fg = colors.black }, + b = { bg = colors.fg_gutter, fg = colors.pink or colors.magenta }, + } + + hl.visual = { + a = { bg = colors.purple, fg = colors.black }, + b = { bg = colors.fg_gutter, fg = colors.purple }, + } + + hl.replace = { + a = { bg = colors.red, fg = colors.black }, + b = { bg = colors.fg_gutter, fg = colors.red }, + } + + hl.terminal = { + a = { bg = colors.green, fg = colors.black }, + b = { bg = colors.fg_gutter, fg = colors.green }, + } + + hl.inactive = { + a = { bg = colors.bg_statusline, fg = colors.cyan }, + b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" }, + c = { bg = colors.bg_statusline, fg = colors.fg_gutter }, + } + + if config.lualine_bold then + for _, mode in pairs(hl) do + mode.a.gui = "bold" + end + end + return hl +end + +return M diff --git a/lua/lualine/themes/eldritch.lua b/lua/lualine/themes/eldritch.lua index 8ff6be6..d5cb085 100644 --- a/lua/lualine/themes/eldritch.lua +++ b/lua/lualine/themes/eldritch.lua @@ -1,49 +1 @@ -local colors = require("eldritch.colors").setup() -local config = require("eldritch.config").options - -local eldritch = {} - -eldritch.normal = { - a = { bg = colors.cyan, fg = colors.black }, - b = { bg = colors.fg_gutter, fg = colors.cyan }, - c = { bg = colors.bg_highlight, fg = colors.fg_sidebar }, -} - -eldritch.insert = { - a = { bg = colors.green, fg = colors.black }, - b = { bg = colors.fg_gutter, fg = colors.green }, -} - -eldritch.command = { - a = { bg = colors.pink, fg = colors.black }, - b = { bg = colors.fg_gutter, fg = colors.pink }, -} - -eldritch.visual = { - a = { bg = colors.purple, fg = colors.black }, - b = { bg = colors.fg_gutter, fg = colors.purple }, -} - -eldritch.replace = { - a = { bg = colors.red, fg = colors.black }, - b = { bg = colors.fg_gutter, fg = colors.red }, -} - -eldritch.terminal = { - a = { bg = colors.green, fg = colors.black }, - b = { bg = colors.fg_gutter, fg = colors.green }, -} - -eldritch.inactive = { - a = { bg = colors.bg_statusline, fg = colors.dark_cyan }, - b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" }, - c = { bg = colors.bg_statusline, fg = colors.fg_gutter }, -} - -if config.lualine_bold then - for _, mode in pairs(eldritch) do - mode.a.gui = "bold" - end -end - -return eldritch +return require("lualine.themes._eldritch").get() From fa7cbac8d8741d5a454045eeb035f8d6a229cd80 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 01:27:59 +0000 Subject: [PATCH 3/3] Address code review feedback for lualine theme colors Co-authored-by: neonvoidx <25580051+neonvoidx@users.noreply.github.com> --- README.md | 44 ++++++++++++++++++++++++++++---- lua/lualine/themes/_eldritch.lua | 4 +-- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1b425be..86a2dc8 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,15 @@ Main Theme repo can be found [here](https://github.com/eldritch-theme/eldritch) +## ✨ Features + +- Supports the latest [Neovim](https://github.com/neovim/neovim) features like TreeSitter and LSP Semantic Tokens +- Terminal colors support +- **Automatic plugin detection** - When using [lazy.nvim](https://github.com/folke/lazy.nvim), plugins are automatically detected and their highlights are enabled +- Over 30+ plugin support with modular highlight groups +- Performance optimized with optional caching +- Highly configurable with `on_colors` and `on_highlights` callbacks + ### Installation Using [lazy.nvim](https://github.com/folke/lazy.nvim): @@ -59,6 +68,18 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim): vim.cmd[[colorscheme eldritch]] ``` +To switch to the darker variant: + +```lua +vim.cmd[[colorscheme eldritch-dark]] +``` + +To switch to the minimal variant: + +```lua +vim.cmd[[colorscheme eldritch-minimal]] +``` + #### [Lualine](https://github.com/nvim-lualine/lualine.nvim) ```lua @@ -93,7 +114,7 @@ If you want transparent background for all of fzf-lua you need to pass the follo require("eldritch").setup({ -- your configuration comes here -- or leave it empty to use the default settings - -- palette = "default", -- This option is deprecated. Use `vim.cmd[[colorscheme eldritch-dark]]` or `vim.cmd[[colorscheme eldritch-minimal]] instead. + style = "default", -- The theme comes in three styles: "default", "darker" and "minimal" transparent = false, -- Enable this to disable setting the background color terminal_colors = true, -- Configure the colors used when opening a `:terminal` in [Neovim](https://github.com/neovim/neovim) styles = { @@ -107,11 +128,25 @@ require("eldritch").setup({ sidebars = "dark", -- style for sidebars, see below floats = "dark", -- style for floating windows }, - sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` - hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. dim_inactive = false, -- dims inactive windows, transparent must be false for this to work lualine_bold = true, -- When `true`, section headers in the lualine theme will be bold + cache = true, -- When set to true, the theme will be cached for better performance + + ---@type table + plugins = { + -- enable all plugins when not using lazy.nvim + -- set to false to manually enable/disable plugins + all = package.loaded.lazy == nil, + -- uses your plugin manager to automatically enable needed plugins + -- currently only lazy.nvim is supported + auto = true, + -- add any plugins here that you want to enable + -- for all possible plugins, see: + -- * https://github.com/eldritch-theme/eldritch.nvim/tree/main/lua/eldritch/groups + -- telescope = true, + }, + --- You can override specific color groups to use other groups or a hex color --- function will be called with a ColorScheme table ---@param colors ColorScheme @@ -119,7 +154,7 @@ require("eldritch").setup({ --- You can override specific highlights to use other groups or a hex color --- function will be called with a Highlights and ColorScheme table - ---@param highlights Highlights + ---@param highlights eldritch.Highlights ---@param colors ColorScheme on_highlights = function(highlights, colors) end, }) @@ -143,7 +178,6 @@ require("eldritch").setup({ styles = { functions = {} }, - sidebars = { "qf", "vista_kind", "terminal", "packer" }, -- Change the "hint" color to the "orange" color, and make the "error" color bright red on_colors = function(colors) colors.hint = colors.orange diff --git a/lua/lualine/themes/_eldritch.lua b/lua/lualine/themes/_eldritch.lua index 76124f7..b0fe8cb 100644 --- a/lua/lualine/themes/_eldritch.lua +++ b/lua/lualine/themes/_eldritch.lua @@ -11,7 +11,7 @@ function M.get(style) hl.normal = { a = { bg = colors.cyan, fg = colors.black }, b = { bg = colors.fg_gutter, fg = colors.cyan }, - c = { bg = colors.bg_statusline, fg = colors.fg_sidebar }, + c = { bg = colors.bg_highlight, fg = colors.fg_sidebar }, } hl.insert = { @@ -40,7 +40,7 @@ function M.get(style) } hl.inactive = { - a = { bg = colors.bg_statusline, fg = colors.cyan }, + a = { bg = colors.bg_statusline, fg = colors.dark_cyan or colors.cyan }, b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" }, c = { bg = colors.bg_statusline, fg = colors.fg_gutter }, }