Skip to content

Commit

Permalink
feat: lightline theme (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd committed May 17, 2021
1 parent 1e7f849 commit 5eb534d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ A dark and light Neovim theme written in Lua ported from the Visual Studio Code
+ [Dashboard](https://github.com/glepnir/dashboard-nvim)
+ [BufferLine](https://github.com/akinsho/nvim-bufferline.lua)
+ [Lualine](https://github.com/hoob3rt/lualine.nvim)
+ [Lightline](https://github.com/itchyny/lightline.vim)
+ [Neogit](https://github.com/TimUntersberger/neogit)
+ [vim-sneak](https://github.com/justinmk/vim-sneak)

## 鈿★笍 Requirements

+ Neovim >= 0.5.0

## 馃摝 Installation

Install the theme with your preferred package manager:
Expand Down Expand Up @@ -88,6 +89,13 @@ require('lualine').setup {
}
```

To enable the `tokyonight` colorscheme for `Lightline`:

```vim
" Vim Script
let g:lightline = {'colorscheme': 'tokyonight'}
```

## 鈿欙笍 Configuration

> 鉂楋笍 configuration needs to be set **BEFORE** loading the color scheme with `colorscheme tokyonight`
Expand Down
2 changes: 2 additions & 0 deletions autoload/lightline/colorscheme/tokyonight.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let s:palette = v:lua.require('lightline.colorscheme.tokyonight')
let g:lightline#colorscheme#tokyonight#palette = lightline#colorscheme#fill(s:palette)
44 changes: 44 additions & 0 deletions lua/lightline/colorscheme/tokyonight.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
local config = require("tokyonight.config")
local colors = require("tokyonight.colors").setup(config)
local util = require("tokyonight.util")

local tokyonight = {}

tokyonight.normal = {
left = {{ colors.black, colors.blue }, { colors.blue, colors.bg }},
middle = {{ colors.blue, colors.fg_gutter }},
right = {{ colors.fg_sidebar, colors.bg_statusline }, { colors.blue, colors.bg }},
error = {{ colors.black, colors.error }},
warning = {{ colors.black, colors.warning }},
}

tokyonight.insert = {
left = {{ colors.black, colors.green }, { colors.blue, colors.bg }},
}

tokyonight.visual = {
left = {{ colors.black, colors.magenta }, { colors.blue, colors.bg }},
}

tokyonight.replace = {
left = {{ colors.black, colors.red }, { colors.blue, colors.bg }},
}

tokyonight.inactive = {
left = {{ colors.blue, colors.bg_statusline }, {colors.dark3, colors.bg }},
middle = {{ colors.fg_gutter, colors.bg_statusline }},
right = {{ colors.fg_gutter, colors.bg_statusline }, {colors.dark3, colors.bg }},
}

if vim.o.background == "light" then
for _, mode in pairs(tokyonight) do
for _, section in pairs(mode) do
for _, subsection in pairs(section) do
subsection[1] = util.getColor(subsection[1])
subsection[2] = util.getColor(subsection[2])
end
end
end
end

return tokyonight

0 comments on commit 5eb534d

Please sign in to comment.