add option for overriding highlights (#596)
This commit is contained in:
parent
c5fe1f711e
commit
fd668e559e
4 changed files with 37 additions and 22 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
local override = require("core.utils").load_config().ui.hl_override
|
||||||
|
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
|
||||||
local colors = require("colors").get()
|
local colors = require("colors").get()
|
||||||
|
@ -23,27 +25,9 @@ local one_bg3 = colors.one_bg3
|
||||||
|
|
||||||
local ui = require("core.utils").load_config().ui
|
local ui = require("core.utils").load_config().ui
|
||||||
|
|
||||||
-- Define bg color
|
local fg = require("core.utils").fg
|
||||||
-- @param group Group
|
local fg_bg = require("core.utils").fg_bg
|
||||||
-- @param color Color
|
local bg = require("core.utils").bg
|
||||||
local function bg(group, color)
|
|
||||||
cmd("hi " .. group .. " guibg=" .. color)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Define fg color
|
|
||||||
-- @param group Group
|
|
||||||
-- @param color Color
|
|
||||||
local function fg(group, color)
|
|
||||||
cmd("hi " .. group .. " guifg=" .. color)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Define bg and fg color
|
|
||||||
-- @param group Group
|
|
||||||
-- @param fgcol Fg Color
|
|
||||||
-- @param bgcol Bg Color
|
|
||||||
local function fg_bg(group, fgcol, bgcol)
|
|
||||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Comments
|
-- Comments
|
||||||
if ui.italic_comments then
|
if ui.italic_comments then
|
||||||
|
@ -155,3 +139,7 @@ fg("TelescopeBorder", one_bg)
|
||||||
fg_bg("TelescopePreviewTitle", green, one_bg)
|
fg_bg("TelescopePreviewTitle", green, one_bg)
|
||||||
fg_bg("TelescopePromptTitle", blue, one_bg)
|
fg_bg("TelescopePromptTitle", blue, one_bg)
|
||||||
fg_bg("TelescopeResultsTitle", red, one_bg)
|
fg_bg("TelescopeResultsTitle", red, one_bg)
|
||||||
|
|
||||||
|
if #override ~= 0 then
|
||||||
|
require(override)
|
||||||
|
end
|
||||||
|
|
|
@ -42,6 +42,7 @@ M.options = {
|
||||||
|
|
||||||
-- ui configs
|
-- ui configs
|
||||||
M.ui = {
|
M.ui = {
|
||||||
|
hl_override = "", -- path of your file which contains highlight stuffs
|
||||||
italic_comments = false,
|
italic_comments = false,
|
||||||
-- theme to be used, check available themes with `<leader> + t + h`
|
-- theme to be used, check available themes with `<leader> + t + h`
|
||||||
theme = "onedark",
|
theme = "onedark",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
local cmd = vim.cmd
|
||||||
M.close_buffer = function(bufexpr, force)
|
M.close_buffer = function(bufexpr, force)
|
||||||
-- This is a modification of a NeoVim plugin from
|
-- This is a modification of a NeoVim plugin from
|
||||||
-- Author: ojroques - Olivier Roques
|
-- Author: ojroques - Olivier Roques
|
||||||
|
@ -330,4 +331,29 @@ M.packer_lazy_load = function(plugin, timer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Highlights functions
|
||||||
|
|
||||||
|
-- Define bg color
|
||||||
|
-- @param group Group
|
||||||
|
-- @param color Color
|
||||||
|
|
||||||
|
M.bg = function(group, col)
|
||||||
|
cmd("hi " .. group .. " guibg=" .. col)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Define fg color
|
||||||
|
-- @param group Group
|
||||||
|
-- @param color Color
|
||||||
|
M.fg = function(group, col)
|
||||||
|
cmd("hi " .. group .. " guifg=" .. col)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Define bg and fg color
|
||||||
|
-- @param group Group
|
||||||
|
-- @param fgcol Fg Color
|
||||||
|
-- @param bgcol Bg Color
|
||||||
|
M.fg_bg = function(group, fgcol, bgcol)
|
||||||
|
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -98,6 +98,6 @@ end
|
||||||
|
|
||||||
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
||||||
|
|
||||||
if string.len(addlsp_confs) ~= 0 then
|
if #addlsp_confs ~= 0 then
|
||||||
require(addlsp_confs).setup_lsp(on_attach, capabilities)
|
require(addlsp_confs).setup_lsp(on_attach, capabilities)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue