Merge pull request #188 from nullchilly/dev

fix: compiler and term colors
dev
Pocco81 2 years ago committed by GitHub
commit cc0d5007fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,8 @@
name: stylua name: stylua
on: on:
push: push:
branches: ["main"] branches:
- dev
paths-ignore: paths-ignore:
- ".github/**" - ".github/**"
@ -13,4 +14,4 @@ jobs:
- uses: JohnnyMorganz/stylua-action@1.0.0 - uses: JohnnyMorganz/stylua-action@1.0.0
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --check --config-path=.stylua.toml . args: --check --config-path=stylua.toml .

@ -13,7 +13,7 @@ local function inspect(t)
return fmt([[{ %s }]], table.concat(list, ", ")) return fmt([[{ %s }]], table.concat(list, ", "))
end end
function util.compile() function M.compile()
local theme = require("catppuccin.lib.mapper").apply() local theme = require("catppuccin.lib.mapper").apply()
local lines = { local lines = {
[[ [[
@ -27,7 +27,6 @@ end
vim.g.colors_name = "catppuccin"]], vim.g.colors_name = "catppuccin"]],
} }
local config = require("catppuccin.config").options local config = require("catppuccin.config").options
local custom_highlights = config.custom_highlights
for property, value in pairs(theme.properties) do for property, value in pairs(theme.properties) do
if type(value) == "string" then if type(value) == "string" then
table.insert(lines, fmt('vim.o.%s = "%s"', property, value)) table.insert(lines, fmt('vim.o.%s = "%s"', property, value))
@ -37,8 +36,8 @@ vim.g.colors_name = "catppuccin"]],
table.insert(lines, fmt("vim.o.%s = %s", property, inspect(value))) table.insert(lines, fmt("vim.o.%s = %s", property, inspect(value)))
end end
end end
local tbl = vim.tbl_deep_extend("keep", theme.integrations, theme.base) local tbl = vim.tbl_deep_extend("keep", theme.integrations, theme.editor)
tbl = vim.tbl_deep_extend("keep", custom_highlights, tbl) tbl = vim.tbl_deep_extend("keep", config.custom_highlights, tbl)
for group, color in pairs(tbl) do for group, color in pairs(tbl) do
if color.link then if color.link then
@ -100,7 +99,7 @@ vim.g.colors_name = "catppuccin"]],
file:close() file:close()
end end
function util.clean() function M.clean()
local config = require("catppuccin.config").options local config = require("catppuccin.config").options
local compiled_path = config.compile.path local compiled_path = config.compile.path
.. (vim.loop.os_uname().sysname == "Windows" and "\\" or "/") .. (vim.loop.os_uname().sysname == "Windows" and "\\" or "/")
@ -109,3 +108,5 @@ function util.clean()
.. ".lua" .. ".lua"
os.remove(compiled_path) os.remove(compiled_path)
end end
return M

@ -24,9 +24,9 @@ function M.syntax(tbl)
end end
end end
function M.properties(tbl) function M.properties(tbl, type)
for property, value in pairs(tbl) do for property, value in pairs(tbl) do
vim.o[property] = value vim[type][property] = value
end end
end end
@ -37,14 +37,14 @@ function M.load(theme)
end end
g.colors_name = "catppuccin" g.colors_name = "catppuccin"
M.properties(theme.properties) M.properties(theme.properties, "o")
M.syntax(theme.editor) M.syntax(theme.editor)
M.syntax(theme.syntax) M.syntax(theme.syntax)
M.syntax(theme.integrations) M.syntax(theme.integrations)
M.syntax(require("catppuccin.config").options.custom_highlights) M.syntax(require("catppuccin.config").options.custom_highlights)
if require("catppuccin.config").options["term_colors"] then if require("catppuccin.config").options["term_colors"] then
M.properties(theme.terminal) M.properties(theme.terminal, "g")
end end
end end

Loading…
Cancel
Save