Skip to content

Commit e9d2562

Browse files
committed
feat: save base_30 variables to file
now users can directly access the color variables outside of hl_add/hl_override, dofile(vim.g.base46_cache .. "colors")
1 parent 35785f8 commit e9d2562

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lua/base46/color_vars.lua

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
local opts = require("nvconfig").base46
2+
local str = ""
3+
local colors = require("base46.themes." .. opts.theme).base_30
4+
5+
for name, hex in pairs(colors) do
6+
str = str .. name .. "='" .. hex
7+
str = str .. "',"
8+
end
9+
10+
str = "return {" .. str .. "}"
11+
12+
return str

lua/base46/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ M.turn_str_to_color = function(tb)
6363
if valtype == "string" and val:sub(1, 1) ~= "#" and val ~= "none" and val ~= "NONE" then
6464
hlgroups[opt] = colors[val]
6565
elseif valtype == "table" then
66-
6766
-- transform table to color
6867
hlgroups[opt] = #val == 2 and lighten(colors[val[1]], val[2])
6968
or mixcolors(colors[val[1]], colors[val[2]], val[3])
@@ -149,6 +148,7 @@ M.compile = function()
149148
end
150149

151150
M.str_to_cache("term", require "base46.term")
151+
M.str_to_cache("colors", require "base46.color_vars")
152152

153153
local all_str = ""
154154

0 commit comments

Comments
 (0)