Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
🔧 (fix #6) Parse lua table inside colors config
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Jun 23, 2021
1 parent e84d1c5 commit 5335310
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Configuration docs updated inside [README.md#configuration](./README.md#-configuration)
- Fix `VertSplit` & `StatusLine` crossover on `hideInactiveStatusline` [check hoob3rt/lualine.nvim#274]
- Change `NvimTreeEndOfBuffer` color on `darkSidebar=false`
- Parse lua table inside `colors` config **[fix #6]**

## [v0.0.1] - 14 June 2021

Expand Down
20 changes: 13 additions & 7 deletions lua/onedark/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,25 @@ function util.load(theme)
end, 0)
end

---@param config Config
---@param colors ColorScheme
---@param config Config
function util.color_overrides(colors, config)
if type(config.colors) == "table" then
for key, value in pairs(config.colors) do
if not colors[key] then error("Color " .. key .. " does not exist") end
if string.sub(value, 1, 1) == "#" then
-- hex override
colors[key] = value

-- Patch: https://github.com/ful1e5/onedark.nvim/issues/6
if type(colors[key]) == "table" then
util.color_overrides(colors[key], {colors = value})
else
-- another group
if not colors[value] then error("Color " .. value .. " does not exist") end
colors[key] = colors[value]
if string.sub(value, 1, 1) == "#" then
-- hex override
colors[key] = value
else
-- another group
if not colors[value] then error("Color " .. value .. " does not exist") end
colors[key] = colors[value]
end
end
end
end
Expand Down

0 comments on commit 5335310

Please sign in to comment.