mirror of
https://github.com/gabehf/base46.git
synced 2026-03-09 15:38:15 -07:00
let users use base_30 colors without importing it
This commit is contained in:
parent
2e925ef039
commit
897c90cc79
2 changed files with 18 additions and 16 deletions
|
|
@ -1,14 +1,7 @@
|
|||
local M = {}
|
||||
|
||||
M.get_colors = function(type)
|
||||
local name
|
||||
|
||||
if vim.g.nvchad_theme then
|
||||
name = vim.g.nvchad_theme
|
||||
else
|
||||
name = nvchad.load_config().ui.theme
|
||||
vim.g.nvchad_theme = name
|
||||
end
|
||||
local name = vim.g.nvchad_theme
|
||||
|
||||
-- theme paths
|
||||
local default_path = "hl_themes." .. name
|
||||
|
|
|
|||
|
|
@ -20,19 +20,28 @@ end
|
|||
require "term_hl"
|
||||
|
||||
-- polish theme specific highlights
|
||||
local theme = pcall(require, "hl_themes." .. ui.theme)
|
||||
local polish_hl = require("base46").get_colors "polish_hl"
|
||||
|
||||
if theme then
|
||||
local polish_hl = require("hl_themes." .. ui.theme).polish_hl
|
||||
|
||||
if polish_hl then
|
||||
highlights = merge_tb(highlights, polish_hl)
|
||||
end
|
||||
if polish_hl then
|
||||
highlights = merge_tb(highlights, polish_hl)
|
||||
end
|
||||
|
||||
-- override user highlights if there are any
|
||||
if ui.hl_override then
|
||||
local user_highlights = nvchad.load_config().ui.hl_override
|
||||
local user_highlights = ui.hl_override
|
||||
local colors = require("base46").get_colors "base_30"
|
||||
|
||||
-- fg = "white" set by user becomes fg = colors["white"]
|
||||
-- so no need for the user to import colors
|
||||
|
||||
for group, _ in pairs(user_highlights) do
|
||||
for key, color in pairs(user_highlights[group]) do
|
||||
if key == "fg" or key == "bg" then
|
||||
user_highlights[group][key] = colors[color]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
highlights = merge_tb(highlights, user_highlights)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue