add module for compiling highlight groups & their colors

v2.5
siduck 3 years ago
parent c82a717975
commit c6a9f4c533

@ -99,11 +99,41 @@ M.load_highlight = function(group)
end end
end end
M.load_theme = function() -- save table
M.load_highlight "defaults" M.table_to_file = function(filename, tb)
M.load_highlight "statusline" local file = io.open(filename, "w")
M.load_highlight "syntax" local result = ""
M.load_highlight(M.turn_str_to_color(config.ui.hl_add))
for hlgroupName, hlgroup_vals in pairs(tb) do
local hlname = "'" .. hlgroupName .. "',"
local opts = ""
for optName, optVal in pairs(hlgroup_vals) do
local valueInStr = type(optVal) == "boolean" and " " .. tostring(optVal) or '"' .. optVal .. '"'
opts = opts .. optName .. "=" .. valueInStr .. ","
end
result = result .. "vim.api.nvim_set_hl(0," .. hlname .. "{" .. opts .. "})"
end
if file then
file:write(result)
file:close()
end
end
-- M.load_highlight(M.turn_str_to_color(config.ui.hl_add))
M.compile = function()
local hl_files = vim.fn.stdpath "data" .. "/site/pack/packer/start/base46/lua/base46/integrations"
for _, file in ipairs(vim.fn.readdir(hl_files)) do
local integration = require("base46.integrations." .. vim.fn.fnamemodify(file, ":r"))
M.table_to_file(
vim.fn.stdpath "data" .. "/site/pack/packer/start/base46_cache/lua/base46_cache/" .. file,
integration
)
end
end end
M.override_theme = function(default_theme, theme_name) M.override_theme = function(default_theme, theme_name)

@ -210,4 +210,325 @@ return {
bg = colors.green, bg = colors.green,
fg = colors.black, fg = colors.black,
}, },
------------------------------------- Syntax ----------------------------------------------
Boolean = {
fg = theme.base09,
},
Character = {
fg = theme.base08,
},
Conditional = {
fg = theme.base0E,
},
Constant = {
fg = theme.base08,
},
Define = {
fg = theme.base0E,
sp = "none",
},
Delimiter = {
fg = theme.base0F,
},
Float = {
fg = theme.base09,
},
Variable = {
fg = theme.base05,
},
Function = {
fg = theme.base0D,
},
Identifier = {
fg = theme.base08,
sp = "none",
},
Include = {
fg = theme.base0D,
},
Keyword = {
fg = theme.base0E,
},
Label = {
fg = theme.base0A,
},
Number = {
fg = theme.base09,
},
Operator = {
fg = theme.base05,
sp = "none",
},
PreProc = {
fg = theme.base0A,
},
Repeat = {
fg = theme.base0A,
},
Special = {
fg = theme.base0C,
},
SpecialChar = {
fg = theme.base0F,
},
Statement = {
fg = theme.base08,
},
StorageClass = {
fg = theme.base0A,
},
String = {
fg = theme.base0B,
},
Structure = {
fg = theme.base0E,
},
Tag = {
fg = theme.base0A,
},
Todo = {
fg = theme.base0A,
bg = theme.base01,
},
Type = {
fg = theme.base0A,
sp = "none",
},
Typedef = {
fg = theme.base0A,
},
------------------------------------- Statusline ----------------------------------------------
StatusLine = {
bg = colors.statusline_bg,
},
St_gitIcons = {
fg = colors.light_grey,
bg = colors.statusline_bg,
bold = true,
},
-- LSP
St_lspError = {
fg = colors.red,
bg = colors.statusline_bg,
},
St_lspWarning = {
fg = colors.yellow,
bg = colors.statusline_bg,
},
St_LspHints = {
fg = colors.purple,
bg = colors.statusline_bg,
},
St_LspInfo = {
fg = colors.green,
bg = colors.statusline_bg,
},
St_LspStatus = {
fg = colors.nord_blue,
bg = colors.statusline_bg,
},
St_LspProgress = {
fg = colors.green,
bg = colors.statusline_bg,
},
St_LspStatus_Icon = {
fg = colors.black,
bg = colors.nord_blue,
},
-- MODES
St_NormalMode = {
bg = colors.nord_blue,
fg = colors.black,
bold = true,
},
St_InsertMode = {
bg = colors.dark_purple,
fg = colors.black,
bold = true,
},
St_TerminalMode = {
bg = colors.green,
fg = colors.black,
bold = true,
},
St_NTerminalMode = {
bg = colors.yellow,
fg = colors.black,
bold = true,
},
St_VisualMode = {
bg = colors.cyan,
fg = colors.black,
bold = true,
},
St_ReplaceMode = {
bg = colors.orange,
fg = colors.black,
bold = true,
},
St_ConfirmMode = {
bg = colors.teal,
fg = colors.black,
bold = true,
},
St_CommandMode = {
bg = colors.green,
fg = colors.black,
bold = true,
},
St_SelectMode = {
bg = colors.nord_blue,
fg = colors.black,
bold = true,
},
-- Separators for mode
St_NormalModeSep = {
fg = colors.nord_blue,
bg = colors.grey,
},
St_InsertModeSep = {
fg = colors.dark_purple,
bg = colors.grey,
},
St_TerminalModeSep = {
fg = colors.green,
bg = colors.grey,
},
St_NTerminalModeSep = {
fg = colors.yellow,
bg = colors.grey,
},
St_VisualModeSep = {
fg = colors.cyan,
bg = colors.grey,
},
St_ReplaceModeSep = {
fg = colors.orange,
bg = colors.grey,
},
St_ConfirmModeSep = {
fg = colors.teal,
bg = colors.grey,
},
St_CommandModeSep = {
fg = colors.green,
bg = colors.grey,
},
St_SelectModeSep = {
fg = colors.nord_blue,
bg = colors.grey,
},
St_EmptySpace = {
fg = colors.grey,
bg = colors.lightbg,
},
St_EmptySpace2 = {
fg = colors.grey,
bg = colors.statusline_bg,
},
St_file_info = {
bg = colors.lightbg,
fg = colors.white,
},
St_file_sep = {
bg = colors.statusline_bg,
fg = colors.lightbg,
},
St_cwd_icon = {
fg = colors.one_bg,
bg = colors.red,
},
St_cwd_text = {
fg = colors.white,
bg = colors.lightbg,
},
St_cwd_sep = {
fg = colors.red,
bg = colors.statusline_bg,
},
St_pos_sep = {
fg = colors.green,
bg = colors.lightbg,
},
St_pos_icon = {
fg = colors.black,
bg = colors.green,
},
St_pos_text = {
fg = colors.green,
bg = colors.lightbg,
},
} }

@ -1,208 +0,0 @@
local colors = require("base46").get_theme_tb "base_30"
return {
StatusLine = {
bg = colors.statusline_bg,
},
St_gitIcons = {
fg = colors.light_grey,
bg = colors.statusline_bg,
bold = true,
},
-- LSP
St_lspError = {
fg = colors.red,
bg = colors.statusline_bg,
},
St_lspWarning = {
fg = colors.yellow,
bg = colors.statusline_bg,
},
St_LspHints = {
fg = colors.purple,
bg = colors.statusline_bg,
},
St_LspInfo = {
fg = colors.green,
bg = colors.statusline_bg,
},
St_LspStatus = {
fg = colors.nord_blue,
bg = colors.statusline_bg,
},
St_LspProgress = {
fg = colors.green,
bg = colors.statusline_bg,
},
St_LspStatus_Icon = {
fg = colors.black,
bg = colors.nord_blue,
},
-- MODES
St_NormalMode = {
bg = colors.nord_blue,
fg = colors.black,
bold = true,
},
St_InsertMode = {
bg = colors.dark_purple,
fg = colors.black,
bold = true,
},
St_TerminalMode = {
bg = colors.green,
fg = colors.black,
bold = true,
},
St_NTerminalMode = {
bg = colors.yellow,
fg = colors.black,
bold = true,
},
St_VisualMode = {
bg = colors.cyan,
fg = colors.black,
bold = true,
},
St_ReplaceMode = {
bg = colors.orange,
fg = colors.black,
bold = true,
},
St_ConfirmMode = {
bg = colors.teal,
fg = colors.black,
bold = true,
},
St_CommandMode = {
bg = colors.green,
fg = colors.black,
bold = true,
},
St_SelectMode = {
bg = colors.nord_blue,
fg = colors.black,
bold = true,
},
-- Separators for mode
St_NormalModeSep = {
fg = colors.nord_blue,
bg = colors.grey,
},
St_InsertModeSep = {
fg = colors.dark_purple,
bg = colors.grey,
},
St_TerminalModeSep = {
fg = colors.green,
bg = colors.grey,
},
St_NTerminalModeSep = {
fg = colors.yellow,
bg = colors.grey,
},
St_VisualModeSep = {
fg = colors.cyan,
bg = colors.grey,
},
St_ReplaceModeSep = {
fg = colors.orange,
bg = colors.grey,
},
St_ConfirmModeSep = {
fg = colors.teal,
bg = colors.grey,
},
St_CommandModeSep = {
fg = colors.green,
bg = colors.grey,
},
St_SelectModeSep = {
fg = colors.nord_blue,
bg = colors.grey,
},
St_EmptySpace = {
fg = colors.grey,
bg = colors.lightbg,
},
St_EmptySpace2 = {
fg = colors.grey,
bg = colors.statusline_bg,
},
St_file_info = {
bg = colors.lightbg,
fg = colors.white,
},
St_file_sep = {
bg = colors.statusline_bg,
fg = colors.lightbg,
},
St_cwd_icon = {
fg = colors.one_bg,
bg = colors.red,
},
St_cwd_text = {
fg = colors.white,
bg = colors.lightbg,
},
St_cwd_sep = {
fg = colors.red,
bg = colors.statusline_bg,
},
St_pos_sep = {
fg = colors.green,
bg = colors.lightbg,
},
St_pos_icon = {
fg = colors.black,
bg = colors.green,
},
St_pos_text = {
fg = colors.green,
bg = colors.lightbg,
},
}

@ -1,118 +0,0 @@
local theme = require("base46").get_theme_tb "base_16"
-- Standard syntax highlighting
return {
Boolean = {
fg = theme.base09,
},
Character = {
fg = theme.base08,
},
Conditional = {
fg = theme.base0E,
},
Constant = {
fg = theme.base08,
},
Define = {
fg = theme.base0E,
sp = "none",
},
Delimiter = {
fg = theme.base0F,
},
Float = {
fg = theme.base09,
},
Variable = {
fg = theme.base05,
},
Function = {
fg = theme.base0D,
},
Identifier = {
fg = theme.base08,
sp = "none",
},
Include = {
fg = theme.base0D,
},
Keyword = {
fg = theme.base0E,
},
Label = {
fg = theme.base0A,
},
Number = {
fg = theme.base09,
},
Operator = {
fg = theme.base05,
sp = "none",
},
PreProc = {
fg = theme.base0A,
},
Repeat = {
fg = theme.base0A,
},
Special = {
fg = theme.base0C,
},
SpecialChar = {
fg = theme.base0F,
},
Statement = {
fg = theme.base08,
},
StorageClass = {
fg = theme.base0A,
},
String = {
fg = theme.base0B,
},
Structure = {
fg = theme.base0E,
},
Tag = {
fg = theme.base0A,
},
Todo = {
fg = theme.base0A,
bg = theme.base01,
},
Type = {
fg = theme.base0A,
sp = "none",
},
Typedef = {
fg = theme.base0A,
},
}
Loading…
Cancel
Save