Skip to content

Commit

Permalink
feat: no longer need load() as part of theme setup
Browse files Browse the repository at this point in the history
  • Loading branch information
olimorris committed Jul 9, 2022
1 parent c4a60ad commit 5d90d33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ call plug#end()
Add the following to an `init.lua` file to start using the theme:

```lua
require('onedarkpro').load()
require('onedarkpro').setup()
```

Alternatively, if using Vimscript:
Expand All @@ -177,7 +177,6 @@ The `vim.o.background` option may be used to set the theme:
```lua
vim.o.background = "dark" -- to load onedark
vim.o.background = "light" -- to load onelight
require("onedarkpro").load()
```

### Default configuration
Expand Down Expand Up @@ -225,7 +224,6 @@ onedarkpro.setup({
window_unfocussed_color = false, -- When the window is out of focus, change the normal background?
}
})
onedarkpro.load()
```

> **Note:** If you wish to use the default config there is no need to copy the above into the setup function.
Expand Down
9 changes: 5 additions & 4 deletions lua/onedarkpro/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ local M = {}

---Setup the theme via the default config or the users own
---@param user_config table
---@return table
---@return function
function M.setup(user_config)
return require("onedarkpro.config").set_config(user_config)
require("onedarkpro.config").set_config(user_config)
return M.load()
end

---Load the theme
---@param name string
---@return table
function M.load(name)
local theme = require("onedarkpro.theme").setup_theme(name)
function M.load()
local theme = require("onedarkpro.theme").setup_theme()
return require("onedarkpro.utils").load_theme(theme)
end

Expand Down
4 changes: 2 additions & 2 deletions lua/onedarkpro/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ end
---Setup the theme by setting the options and the highlight groups
---@param name string Optional: The name of the theme to load
---@return table theme
function M.setup_theme(name)
function M.setup_theme()
theme.config = require("onedarkpro.config").config
theme.colors = require("onedarkpro.colors").get_theme_colors(name)
theme.colors = require("onedarkpro.colors").get_theme_colors()
theme.options = set_options()
theme.hlgroups = set_hlgroups()

Expand Down

0 comments on commit 5d90d33

Please sign in to comment.