Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onenord Light Theme #16

Merged
merged 7 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

![Screenshot of the onenord theme](https://user-images.githubusercontent.com/52933714/138731499-c4092892-46cf-45e6-8947-edb5dfe32c06.png)

![Screenshot of the onenordlight theme](https://user-images.githubusercontent.com/52933714/144966905-4b17902b-53bb-4de7-8bd8-bb7d72603ca6.png)

## Features

Onenord is a Neovim theme written in Lua that combines the [Nord](https://www.nordtheme.com) and [Atom One Dark](https://github.com/atom/atom/tree/master/packages/one-dark-ui) color palettes. More specifically, it seeks to add more vibrance to the Nord theme and provide a great programming experience by leveraging [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter)!
Expand Down Expand Up @@ -78,6 +80,7 @@ require('lualine').setup {
The configuration of different options is done through a setup function which will handle setting the colors, so there's no need to set `colorscheme` yourself! This is an example of the function with the default values:
```lua
require('onenord').setup({
style = nil, -- "dark" or "light". Alternatively, remove the option and set vim.o.background instead
borders = true, -- Split window borders
italics = {
comments = false, -- Italic comments
Expand All @@ -92,10 +95,11 @@ require('onenord').setup({
eob_lines = true, -- Hide the end-of-buffer lines
},
custom_highlights = {}, -- Overwrite default highlight groups
custom_colors = {}, -- Overwrite default colors
})
```

Here is an example of overwriting the default highlight groups:
Here is an example of overwriting the default highlight groups and colors:

```lua
local colors = require("onenord.colors")
Expand All @@ -104,6 +108,9 @@ require("onenord").setup({
custom_highlights = {
TSConstructor = { fg = colors.dark_blue },
},
custom_colors = {
red = "#ffffff",
},
})
```

Expand Down
8 changes: 6 additions & 2 deletions colors/onenord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ if vim.g.onenord_debug == true then
package.loaded["onenord"] = nil
package.loaded["onenord.util"] = nil
package.loaded["onenord.colors"] = nil
package.loaded["onenord.colors.onenord"] = nil
package.loaded["onenord.colors.onenordlight"] = nil
package.loaded["onenord.theme"] = nil
end

local util = require("onenord.util")
local config = require("onenord.config")
local onenord = require("onenord")

util.load(false)
config.set_options({ style = "dark" })
onenord.load(false)
15 changes: 15 additions & 0 deletions colors/onenordlight.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Refresh cache for local debugging and development purposes
if vim.g.onenord_debug == true then
package.loaded["onenord"] = nil
package.loaded["onenord.util"] = nil
package.loaded["onenord.colors"] = nil
package.loaded["onenord.colors.onenord"] = nil
package.loaded["onenord.colors.onenordlight"] = nil
package.loaded["onenord.theme"] = nil
end

local config = require("onenord.config")
local onenord = require("onenord")

config.set_options({ style = "light" })
onenord.load(false)
6 changes: 5 additions & 1 deletion doc/onenord.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ This is an example of the function with the default values:
>
require('onenord').setup({
borders = true, -- Split window borders
style = nil, -- "dark" or "light". Alternatively, remove the option and set vim.o.background instead
italics = {
comments = false, -- Italic comments
strings = false, -- Italic strings
Expand All @@ -117,14 +118,17 @@ This is an example of the function with the default values:
})
<

Here is an example of overwriting the default highlight groups:
Here is an example of overwriting the default highlight groups and colors:
>
local colors = require("onenord.colors")

require("onenord").setup({
custom_highlights = {
TSConstructor = { fg = colors.dark_blue },
},
custom_colors = {
red = "#ffffff",
},
})
<

Expand Down
2 changes: 1 addition & 1 deletion lua/lualine/themes/onenord.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local colors = require("onenord.colors")
local colors = require("onenord.colors").load()

local onenord = {}

Expand Down
44 changes: 0 additions & 44 deletions lua/onenord/colors.lua

This file was deleted.

22 changes: 22 additions & 0 deletions lua/onenord/colors/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
local light_colors = require("onenord.colors.onenordlight")
local dark_colors = require("onenord.colors.onenord")

local colors = {}

function colors.load()
local config = require("onenord.config")

-- if style is set, it takes priority
-- otherwise, use vim.o.background
if not config.options.style then
config.set_options({ style = vim.o.background })
end

if config.options.style == "light" then
return light_colors
else
return dark_colors
end
end

return colors
44 changes: 44 additions & 0 deletions lua/onenord/colors/onenord.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local colors = {
fg = "#C8D0E0",
fg_light = "#E5E9F0",
bg = "#2E3440",
gray = "#646A76",
light_gray = "#6C7A96",
cyan = "#88C0D0",
blue = "#81A1C1",
dark_blue = "#5E81AC",
green = "#A3BE8C",
light_green = "#8FBCBB",
dark_red = "#BF616A",
red = "#D57780",
light_red = "#DE878F",
pink = "#E85B7A",
dark_pink = "#E44675",
orange = "#D08F70",
yellow = "#EBCB8B",
purple = "#B988B0",
light_purple = "#B48EAD",
none = "NONE",
}

-- more semantically meaningful colors

colors.error = colors.dark_red
colors.warn = colors.orange
colors.info = colors.green
colors.hint = colors.purple

colors.diff_add = colors.green
colors.diff_add_bg = "#324125"
colors.diff_change = colors.dark_blue
colors.diff_change_bg = "#334963"
colors.diff_remove = colors.red
colors.diff_remove_bg = colors.dark_red
colors.diff_text_bg = "#446285"

colors.active = "#353B49"
colors.float = "#3B4252"
colors.highlight = "#3F4758"
colors.selection = "#4C566A"

return colors
44 changes: 44 additions & 0 deletions lua/onenord/colors/onenordlight.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local colors = {
fg = "#2E3440",
fg_light = "#4C566A",
bg = "#F7F8FA",
gray = "#838FA6",
light_gray = "#646A76",
cyan = "#3EA1AD",
blue = "#3879C5",
dark_blue = "#1B40A6",
green = "#48A53D",
light_green = "#5F9E9D",
dark_red = "#C53B40",
red = "#CB4F53",
light_red = "#D16366",
pink = "#E85B7A",
dark_pink = "#E44675",
orange = "#EE5E25",
yellow = "#BA793E",
purple = "#9F4ACA",
light_purple = "#9665AF",
none = "NONE",
}

-- more semantically meaningful colors

colors.error = colors.dark_red
colors.warn = colors.orange
colors.info = colors.green
colors.hint = colors.purple

colors.diff_add = colors.green
colors.diff_add_bg = "#A3BE8C"
colors.diff_change = colors.dark_blue
colors.diff_change_bg = "#DDE6EE"
colors.diff_remove = colors.red
colors.diff_remove_bg = colors.light_red
colors.diff_text_bg = "#D0DCE8"

colors.active = "#EFF0F2"
colors.float = "#EDEEF0"
colors.highlight = "#EAEBED"
colors.selection = "#DCDEE1"

return colors
2 changes: 2 additions & 0 deletions lua/onenord/config.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local config = {}

local defaults = {
style = nil, -- "dark" or "light". Alternatively, remove the option and set vim.o.background instead
borders = true, -- Split window borders
italics = {
comments = false, -- Italic comments
Expand All @@ -15,6 +16,7 @@ local defaults = {
eob_lines = true, -- Hide the end-of-buffer lines
},
custom_highlights = {}, -- Overwrite default highlight groups
custom_colors = {}, -- Overwrite default colors
}

config.options = {}
Expand Down
16 changes: 11 additions & 5 deletions lua/onenord/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
local config = require("onenord.config")
local util = require("onenord.util")

local function setup(options)
local onenord = {}

function onenord.setup(options)
config.set_options(options)
util.load(true)
onenord.load(true)
end

function onenord.load(exec_autocmd)
local colors = require("onenord.colors").load()

util.load(colors, exec_autocmd)
end

return {
setup = setup,
}
return onenord
Loading