Skip to content

Commit

Permalink
Allow user to override any entry in the default_theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Mar 20, 2022
1 parent 3ddf36e commit 7d2c111
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lua/default_theme/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ local colors = {
purple = "#c678dd",
}

return colors
return require("core.utils").user_plugin_opts("default_theme.colors", colors)
30 changes: 16 additions & 14 deletions lua/default_theme/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@ vim.o.background = "dark"
vim.o.termguicolors = true
vim.g.colors_name = "default_theme"

C = require "default_theme.colors"
local user_plugin_opts = require("core.utils").user_plugin_opts

local util = require "default_theme.util"
local base = require "default_theme.base"
local treesitter = require "default_theme.treesitter"
local lsp = require "default_theme.lsp"
local others = require "default_theme.others"

local default_theme = {
base,
treesitter,
lsp,
others,
local modules = {
"base",
"treesitter",
"lsp",
"others",
}

for _, file in ipairs(default_theme) do
for group, colors in pairs(file) do
util.highlight(group, colors)
end
local highlights = {}

C = require "default_theme.colors"

for _, module in ipairs(modules) do
highlights = vim.tbl_deep_extend("force", highlights, require("default_theme." .. module))
end

for group, colors in pairs(user_plugin_opts("default_theme.highlights", highlights)) do
util.highlight(group, colors)
end

0 comments on commit 7d2c111

Please sign in to comment.