Skip to content

Commit

Permalink
Tweaked global variable assignment (releated to projekt0n#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Jul 21, 2021
1 parent 3cc66f2 commit d576d65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 14 additions & 15 deletions lua/github-theme/config.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
---@class Config
local config

local vimConfig = false

local themeStyleKey = "github_theme_style"
-- shim vim for kitty and other generators
vim = vim or {g = {}, o = {}}
vim.g.githubThemeStyle = "dark"

-- @return string
local function getThemeStyle()
if vim.g.githubThemeStyle == nil then
return config.themeStyle
else
return vim.g.githubThemeStyle
end
end

config = {
themeStyle = "dark",
themeStyle = getThemeStyle(),
transparent = false,
commentStyle = "italic",
keywordStyle = "italic",
Expand All @@ -30,26 +37,18 @@ local function applyConfiguration(userConfig)
if config[key] ~= nil then
config[key] = value
-- useful for `lualine`
if key == "themeStyle" then vim.g[themeStyleKey] = value end
if key == "themeStyle" and value ~= vim.g.githubThemeStyle then
vim.g.githubThemeStyle = value
end
else
error("projekt0n/github-nvim-theme: Option " .. key .. " does not exist") -- luacheck: ignore
end
end
end
end

-- @return string
local function getThemeStyle()
if vim.g[themeStyleKey] == nil then
return config.themeStyle
else
return vim.g[themeStyleKey]
end

end
return {
config = config,
vimConfig = vimConfig,
applyConfiguration = applyConfiguration,
getThemeStyle = getThemeStyle
}
2 changes: 1 addition & 1 deletion lua/lualine/themes/github.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local colors = require("github-theme.colors").setup(config)

return {
normal = {
a = {bg = colors.green, fg = colors.bg},
a = {bg = colors.blue, fg = colors.bg},
b = {bg = colors.bg2, fg = colors.blue},
c = {bg = colors.bg, fg = colors.fg_light}
},
Expand Down

0 comments on commit d576d65

Please sign in to comment.